In C#, given a DateTime object, how do I get a ISO 8601 date in string format?
- by Iain
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