Skip to content

Instantly share code, notes, and snippets.

@kristopherjohnson
Created June 8, 2012 18:12
Show Gist options
  • Save kristopherjohnson/2897354 to your computer and use it in GitHub Desktop.
Save kristopherjohnson/2897354 to your computer and use it in GitHub Desktop.
Format .NET DateTime in various formats
// 2008-09-22T13:57:31
DateTime.UtcNow.ToString("s");
// 2008-09-22T13:57:31.2311892-04:00
DateTime.UtcNow.ToString("yyyy-MM-ddTHH\:mm\:ss.fffffffzzz");
//2008-09-22T14:01:54.9571247Z
DateTime.UtcNow.ToString("o");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment