In C#, given a DateTime object, how do I get a ISO 8601 date in string format?

Posted by Iain on Stack Overflow See other posts from Stack Overflow or by Iain
Published on 2008-09-22T13:56:08Z Indexed on 2010/04/04 10:53 UTC
Read the original article Hit count: 443

Filed under:
|

Given:

DateTime.UtcNow

How do I get a string which represents the same value in an ISO 8601 compliant format?

Note that ISO 8601 defines a number of similar formats: (Wikipedia). The specific format I am looking for is:

yyyy-MM-ddTHH:mm:ssZ

© Stack Overflow or respective owner

Related posts about c#

Related posts about datetime