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
The Universal Time Coordinated is a coordinated time scale. It is maintained by the Bureau International des Poids et Mesures (BIPM), which is also known as the "Z time" or "Zulu Time. " The UTC time plays a vital role because other time zones depend on it.
Universal Coordinated Time (UTC) is the basis for modern timekeeping. Among other things, it provides a common baseline for converting between incremental and local time. The time zone offset for UTC is 0. UTC is often indicated in field-based formats using Z .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With