Given:
DateTime.UtcNow
How do I get a string which represents the same value in an ISO 8601-compliant format?
Note that ISO 8601 de
The
"s"
standard format specifier represents a custom date and time format string that is defined by the DateTimeFormatInfo.SortableDateTimePattern property. The pattern reflects a defined standard (ISO 8601), and the property is read-only. Therefore, it is always the same, regardless of the culture used or the format provider supplied. The custom format string is"yyyy'-'MM'-'dd'T'HH':'mm':'ss"
.When this standard format specifier is used, the formatting or parsing operation always uses the invariant culture.
– from MSDN