c# GMT time equivalent with UTC time?
How can I get the GMT time in .net(c#) ... is the UTC time equivalen开发者_JAVA技巧t to the GMT time?
Thanks, Radu
Yes, Universal Time, "Zulu time", and UTC are effectively modern names for Greenwich Mean Time.
Yes, the UTC time is (for all intents and purposes) equivalent to the GMT time. You can use the DateTime.ToUniversalTime()
method to get the UTC time. For example, to get the current UTC time:
DateTime.Now.ToUniversalTime()
"GMT" is ambiguous, you need to avoid the term. It could represent the time kept by the Royal Observatory in Greenwich, that matches UTC. Or it could match the name of the timezone for London. Where daylight savings time is observed, it only matches UTC in the winter.
GMT is the same time as UTC, but it is a different timezone so theoretically they could be different (though that is highly unlikely).
From Wikipedia:
Though there are scientific differences (explained below) between "Coordinated Universal Time" and the time standard known as Greenwich Mean Time (GMT) - in the very broadest sense as understood by non-scientists, "Coordinated Universal Time" in essence is Greenwich Mean Time (GMT). When times are listed as being "UTC" - this is de facto the equivalent of "GMT".
use
DateTime.Now.ToUniversalTime()
精彩评论