Mega Code Archive

 
Categories / C# / Date Time
 

Gets a DateTime value that represents the Coordinated Universal Time (UTC) date and time from DateTimeOffset

using System; using System.Globalization; public class Example {    public static void Main()    {         DateTimeOffset offsetTime = new DateTimeOffset(2007, 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());          } }