:
http://msdn.microsoft.com/en-us/library/az4se3k1.aspx#UniversalFull
, :
myDate.ToString("u");
:
DateTime date1 = new DateTime(2008, 4, 10, 6, 30, 0);
Console.WriteLine(date1.ToUniversalTime().ToString("u"));
However, this is not quite what you need (although it probably will still work), so you may need to use a custom format:
DateTime date1 = new DateTime(2008, 4, 10, 6, 30, 0);
Console.WriteLine(date1.ToUniversalTime().ToString("yyyy-MM-dd'T'HH:mm:ss.fffffffZ"));
source
share