.NET DateTime to W3C Format

Here’s a fun quickie! I needed to translate a C# DateTime into W3C format. Here’s how I did it, courtesy of StackOverflow:

DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffffzzz");
// 2012-12-04T17:10:12.5880605-05:00

Shablam!

Unknown's avatar

Author: Adam Prescott

I'm enthusiastic and passionate about creating intuitive, great-looking software. I strive to find the simplest solutions to complex problems, and I embrace agile principles and test-driven development.

Leave a comment