Permalink
Cannot retrieve contributors at this time
Fetching contributors…
| // <Snippet8> | |
| using System; | |
| public class Example | |
| { | |
| public static void Main() | |
| { | |
| DateTime dat = new DateTime(2009, 6, 15, 13, 45, 30, | |
| DateTimeKind.Unspecified); | |
| Console.WriteLine("{0} ({1}) --> {0:O}", dat, dat.Kind); | |
| DateTime uDat = new DateTime(2009, 6, 15, 13, 45, 30, | |
| DateTimeKind.Utc); | |
| Console.WriteLine("{0} ({1}) --> {0:O}", uDat, uDat.Kind); | |
| DateTime lDat = new DateTime(2009, 6, 15, 13, 45, 30, | |
| DateTimeKind.Local); | |
| Console.WriteLine("{0} ({1}) --> {0:O}\n", lDat, lDat.Kind); | |
| DateTimeOffset dto = new DateTimeOffset(lDat); | |
| Console.WriteLine("{0} --> {0:O}", dto); | |
| } | |
| } | |
| // The example displays the following output: | |
| // 6/15/2009 1:45:30 PM (Unspecified) --> 2009-06-15T13:45:30.0000000 | |
| // 6/15/2009 1:45:30 PM (Utc) --> 2009-06-15T13:45:30.0000000Z | |
| // 6/15/2009 1:45:30 PM (Local) --> 2009-06-15T13:45:30.0000000-07:00 | |
| // | |
| // 6/15/2009 1:45:30 PM -07:00 --> 2009-06-15T13:45:30.0000000-07:00 | |
| // </Snippet8> |