53

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

Community
  • 1
  • 1
frankadelic
  • 20,543
  • 37
  • 111
  • 164
  • 3
    You are not alone in being confused: http://connect.microsoft.com/VisualStudio/feedback/details/298123/timezoneinfo-believes-that-gmt-daylight-time-exists-but-there-is-no-such-thing – Mark Ransom Feb 18 '10 at 23:07
  • 4
    Link to connect is dead – Simon D Apr 13 '15 at 03:33

7 Answers7

42

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.

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • 1
    Interesting... whereas TimeZoneInfo.FindSystemTimeZoneById("Greenwich Standard Time") returns false, same as UTC. – frankadelic Feb 18 '10 at 22:45
  • 11
    I don't think Windows is messing up, it's just a terminology confusion. They're using GMT to refer to the timezone containing Dublin, Edinburgh, Lisbon, London among others, and those **do** use daylight savings. – Mark Ransom Feb 18 '10 at 22:56
  • 1
    @HansPassant Can you please point out where http://wwp.greenwichmeantime.com/what-is-gmt.htm states that GMT doesn't adjust for DST (which I think implies UTC does)? I had thought this myself - that GMT adjusts for DST and UTC doesn't, but now I am not convinced. My current understanding is that GMT and UTC are themselves fixed and that the time zones are reflected as offsets to that and DST is a further adjustment to that fixed time. So in other words GMT is GMT and if you are in a zone where you observe DST, that is reflected as GMT +/- timezone offset and DST adjustment. – Matthew Oct 07 '14 at 00:40
  • 2
    @MAtt http://wwp.greenwichmeantime.com/what-is-gmt I live in UK and we stick from GMT to BST when the clocks change GMT has never had daylight savings - it is the base time – mmmmmm Oct 29 '15 at 20:30
28

[I am really just backing up Hans Passant's answer]

There seems to me to be a confusion over the use of the term "GMT" which seems to be used to mean "Greenwich Mean Time" and also the timezone used in the UK/Ireland - which flips between GMT in winter and British Summer time in summer and doesn't seem to have a well defined name in its own right!

To confuse things even more, I ran the sample code from the MSDN docs for TimeZoneInfo.GetSystemTimeZones and looked at the output.

I was very surprised to see the following definition of the "GMT Standard Time" timezone

ID: GMT Standard Time
   Display Name:  (UTC) Dublin, Edinburgh, Lisbon, London
   Standard Name:                       GMT Standard Time
   Daylight Name:                       GMT Daylight Time   ***Has Daylight Saving Time***
   Offset from UTC:                       0 hours, 0 minutes
   Number of adjustment rules:                          1
   Adjustment Rules:
      From 01/01/0001 00:00:00 to 31/12/9999 00:00:00
      Delta: 01:00:00
      Begins at 01:00 on Sunday of week 5 of March
      Ends at 02:00 on Sunday of week 5 of October

It seems (at least to me) that whoever was in charge of defining timezones in Microsoft has really muddied the waters even further here.

They obviously wanted to describe the timezone in use in UK/Ireland but they gave it an ID that included the terms "GMT" and UTC in the ID and the display name. I feel fairly confident that this timezone definition (whatever it should be called) is not UTC. It may have times that are very similar to UTC for half of the year but that is all!

informatik01
  • 16,038
  • 10
  • 74
  • 104
Chris Fewtrell
  • 7,555
  • 8
  • 45
  • 63
  • 1
    A substantial minority of people in Britain think that *GMT* means wall-clock time where they live, in other words, that it shifts forward for the summer. They are just wrong. But to accommodate this widespread misconception, my wife, when organizing online game events, specifies *UK time* not *GMT* or *BST*. – BoarGules May 28 '17 at 22:48
18

This is a late response that the original questioner is unlikely to read but which people who google for this topic may find.

The names GMT Standard Time and GMT Daylight Time are unknown outside of Redmond. They are mythical animals that appear only in the bestiary called the Windows Registry. In the real world, in winter the UK observes GMT (Greenwich Mean Time) and in summer it observes BST (British Summer Time). BST is 1 hour ahead (eastwards) of GMT. Europeans generally do not talk about "daylight time" but "summer time", at least in the languages I know.

One respondent has said one should use UTC in preference to GMT. This advice, from the International Astronomical Union, dates back to 1935. Its point was that, before 1925, GMT was counted from noon not midnight, so even though it was 10 years later, the possibility of ambiguity might still have then persisted. But it's a bit out of date now. For the past 80 years the terms GMT and Universal Time have been almost synonymous. Not quite, of course. But you need an astronomer to explain the difference to you. If you are concerned about hours, not seconds, you probably won't care.

GMT is about civil timekeeping in English-speaking countries. It is not obsolete. It is enshrined in law in the UK, Ireland, Canada, even Belgium.

The various flavours of Universal Time are about astronomical timekeeping.

And civil timekeeping, I think, was what the original question was about.

BoarGules
  • 16,440
  • 2
  • 27
  • 44
13

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

dariush
  • 3,191
  • 3
  • 24
  • 43
Asad
  • 21,468
  • 17
  • 69
  • 94
  • 2
    I recommend you reformat your answer because in the way it is presented, the reader might think that GMT, UTC and DST are analogous in their meaning. GMT and UTC are analogous but DST is not. – Matthew Oct 07 '14 at 00:35
9

"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.

egmfrs
  • 1,272
  • 3
  • 17
  • 31
1

The TimeZoneInfo object having the .Id of "GMT Standard Time" corresponds to the .DisplayName of "(UTC) Dublin, Edinburgh, Lisbon, London".

This time zone uses Greenwich Mean Time (GMT) (UTC+0) during the winter months, and British Summer Time (BST) (UTC+1) during the summer months.

Reference here.

The time zone for UTC has an .Id of "UTC" and a .DisplayName of "(UTC) Coordinated Universal Time".

They are two different time zone settings.

Also, when looking at the list of time zone display names in Windows:

Time Zone List

The value in parenthesis is just the standard offset, so while it looks like there are four different settings for UTC, there is really only one. It's just that the other three zones use UTC as their base offset when Daylight Saving Time is not in effect.

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
0

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.

ChrisF
  • 134,786
  • 31
  • 255
  • 325
Chris
  • 6,272
  • 9
  • 35
  • 57
  • 2
    GMT (Greenwich Mean Time) is largely misused these days and for the cases of international or global standards, it should be normally replaced with UTC, except for dealing with "standard time" within the UK. – mctylr Feb 18 '10 at 22:05
  • "Time, time, time ... see what's become of me ..." (Paul Simon/Bookends) – Richard Hammond Jan 22 '21 at 00:09