Difference between UTC and GMT Standard Time in .NET

Viewed 64379

In .NET, the following statements return different values:

Response.Write(
  TimeZoneInfo.ConvertTime(
    DateTime.Parse("2010-07-01 5:30:00.000"),
    TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"),
    TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time"))
  );
// displays 7/1/2010 1:30:00 PM

..and this...

Response.Write(
  TimeZoneInfo.ConvertTime(
    DateTime.Parse("2010-07-01 5:30:00.000"),
    TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"),
    TimeZoneInfo.FindSystemTimeZoneById("UTC"))
  );
// displays 7/1/2010 12:30:00 PM

Why is this? I thought UTC and GMT Standard Time are equivalent.


Update

Upon further testing, I find that the following appear to be equivalent:

"UTC"

"Greenwich Mean Time"

"Morocco Standard Time"

Whereas, the following is different during summer months:

"GMT Standard Time"

Perhaps my question should be, why are "Greenwich Mean Time" and "GMT Standard Time" different?

End Update

7 Answers

GMT does not adjust for Daylight saving time (DST). You can hear it from the horse's mouth on this web site.

Add this line of code to see the source of the problem:

  Console.WriteLine(TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time").SupportsDaylightSavingTime);

Output: True.

This is not a .NET problem, it is Windows messing up. The registry key that TimeZoneInfo uses is HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\GMT Standard Time. You'd better stick with UTC.

The difference is as follows:

  • Greenwich Mean Time (GMT) is a term originally referring to mean solar time at the Royal Observatory in Greenwich, London. whereas
  • Coordinated Universal Time (UTC) (French: Temps Universel Coordonné) is a time standard based on International Atomic Time (TAI) with leap seconds added at irregular intervals to compensate for the Earth's slowing rotation
  • Day Light Saving Time (DST) on the other hand is advancing clocks To and for with season changes, To make max use of day light.

    "It is observed in many countries but not all". It might be variable, as last summer some countries like Pakistan, decided to bring back clocks a month later than they normally do.

  • World Time Zones is a good resource for up-to date time information around the globe.

Hope this helps

"GMT Standard Time" = UK Time (which will be GMT+0 in the winter or GMT+1 if it's the summer in the UK.)

Basically if you want to convert UTC to UK time, use "GMT Standard Time"

Plain old "GMT" (or Greenwich Mean Time) is more or less UTC, give or take a few milliseconds. It doesn't adjust for daylight saving in the UK so we've never had a use case for it.

This has kind of been explained in a very long winded way by all the other answers, some of which are misleading or contradictory, hence I wanted to provide yet another answer in the hope it saves someone all the reading and confusion.

Here is a discussion of Coordinated Univeral Timezones. It seems that UTC is usually used when a high precision is need for the time frame. Greenwhich Meantime is pretty close and is used back and forth with UTC.

Hope this helps some.

Related