Reputation: 303
There are a lot of countries which change from CET
(Central European Time) to CEST
(Central European Summer Time) during DST
(Daylight Saving Time).
So I thought that the Microsoft timezone database would have CEST
as a time zone but I can only find CET
.
CET has an UTC-Offset of +1
CEST has an UTC-Offset of +2
Would it be a problem if I would simply use another timezone with the same offset as CEST
? And if so, how else am I supposed to get the CEST
time from the database?
Upvotes: 0
Views: 4641
Reputation: 241798
The Microsoft Windows time zones that include the word "Standard" in their identifiers, such as Pacific Standard Time
, Central Europe Standard Time
or W. Europe Standard Time
still represent the entirety of the time zone - including periods that might be under daylight saving time (aka "summer time").
You should not choose a different time zone during the DST period.
There is only one caveat: Windows computers have a date/time setting called "Adjust for daylight saving time automatically". This is on by default, and in most cases should never be turned off. However, if a user has turned it off, then they will not get the benefit of the system understanding how to apply daylight time correctly.
In .NET (as you tagged your question C#), this behavior only surfaces on Windows through APIs that use the system-local time zone, such as DateTime.Now
or TimeZoneInfo.Local
. If you ask for a time zone by its identifier, DST is always applied correctly regardless of the system's DST setting.
Upvotes: 3