.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!

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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: