Up:: Programming

Format Date Time

 
Console.WriteLine(DateTime.UtcNow.ToString("o"));  
Console.WriteLine(DateTime.Now.ToString("o"));
 
Console.WriteLine(DateTime.UtcNow.ToString("s") + "Z");
 
// 2012-07-09T19:22:09.1440844Z  
// 2012-07-09T12:22:09.1440844+02:00
 
// 2012-07-09T19:22:09Z -- no milliseconds