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

Advertisements

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 )

Google+ photo

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

Connecting to %s