Home > OS >  What happens to TimeZoneInfo if a country changes it's Daylight savings settings?
What happens to TimeZoneInfo if a country changes it's Daylight savings settings?

Time:09-22

In .Net there is a TimeZoneInfo class that can convert DateTimes from one TZ to another and it does so with daylight savings in mind.

I'm guessing , internally, .Net is just hardcoded with all the data about when daylight savings starts and ends.

My question is - if I have an app that uses TimeZoneInfo to convert between TZs and a certain country changes it's daylight savings setting (or "policy" or whatever humans call it) the only way to reflect that change in my app would be to manually set a check for that country or apply some .Net update?

In addition, since Daylight Savings is per country and TimeZoneInfo works with Time Zones, how do I tell it to convert a time with a specific country in mind? I can only see a constructor that takes a timezone ID.

CodePudding user response:

Depending on the package, the time zone data comes from your OS so the package will update when the OS is updated. This is how SQL server works as well. For example, the US Congress changed DTS in the mid 2000's we had to release a Windows update to customers to make sure our code ran with the correct time. Some NuGet libraries have to be updated whenever this happens. For example, TimeZoneConverter gets updated when a time zone changes.

Note: DTS and time zones are controlled by laws so there is no algorithm or formula for determining them. Some areas of the United States, Hawaii and Arizona (but not all of it), don't have DTS at all.

  • Related