You can get this using ToString with:
var text = date.ToString("yyyy-MM-dd'T'HH:mm:ss'Z'",
CultureInfo.InvariantCulture);
I do not think that the standard date / time format that covers this is unfortunately.
Of course, if it is not UTC date / time, then it will be a lie (which means the “Z” bit). You can call DateTime.ToUniversalTime()to convert it, of course.
source
share