C# DateTimeOffset UtcDateTime
Description
DateTimeOffset UtcDateTime
gets a DateTime value that
represents the Coordinated Universal Time (UTC) date and time of the current
DateTimeOffset object.
Syntax
DateTimeOffset.UtcDateTime
has the following syntax.
public DateTime UtcDateTime { get; }
Example
The following example shows how to use of the UtcDateTime property to display a DateTimeOffset value and its corresponding UTC time.
using System;//from w w w .j ava 2 s. c o m
public class MainClass{
public static void Main(String[] argv){
DateTimeOffset offsetTime = new DateTimeOffset(2014, 11, 25, 11, 14, 00,
new TimeSpan(3, 0, 0));
Console.WriteLine("{0} is equivalent to {1} {2}",
offsetTime.ToString(),
offsetTime.UtcDateTime.ToString(),
offsetTime.UtcDateTime.Kind.ToString());
}
}
The code above generates the following result.