c# convert datetime to ISO 8601 string format code example
Example 1: how to convert date to Complete ISO-8601 date in c#
string isoFormatDateString = dateTimeObject.ToUniversalTime().ToString("s") + "Z";
Example 2: c# datetime iso 8601 format
var newTime = theTime.Date.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
// returns "2017-06-26T00:00:00.000Z"