Mega Code Archive

 
Categories / C# Book / 02 Essential Types
 

0271 Calling ToString on a DateTimeOffset also shows the offset

using System; using System.Text; class Sample { public static void Main() { DateTimeOffset dt = new DateTimeOffset(2000, 2, 3, 10, 20, 30, new TimeSpan()); Console.WriteLine(dt.ToString()); } } The output: 2/3/2000 10:20:30 AM +00:00