Home > Enterprise >  IANA to Windows timezone mapping
IANA to Windows timezone mapping

Time:04-15

I am trying to understand how to map IANA timezones to Windows timezones. I did see various posts on here about TimeZoneConverter and I started to use it. However, there is one question which I did not find an answer for:

Since Window to IANA timezones are a one-to-many, if we convert from IANA to Windows, is there a chance that the actual offset and DST flag might be wrong. For example, is there a situatation where a Windows timezone covers 2 hours of time while IANA has two different timezones for each of those hours (of the two). This way if we take the IANA for the second hour and convert it to Windows timezone, the actual offset would be different/changes.

It is less important for us to be able to map from IANA -> Windows and then back to IANA to get same timezone name. It is very important that when we do the re-mapping, the actual offsets and DST flags do not change.

Thank you

CodePudding user response:

It is very important that when we do the re-mapping, the actual offsets and DST flags do not change.

That's effectively requiring the Windows database and the IANA database to always be exactly in sync. While I can understand the desire, it's an unrealistic expectation. Aside from anything else, both databases change over time, as governments make changes to their rules. Unless you ensure that you change both versions at exactly the same time (on all machines you use!) there will always be the possibility of discrepancies. That's aside from the actual data being different in the stable state - which also happens.

If you look at the ICU mapping between Windows and IANA zones names (e.g. this copy in the Noda Time repo) you'll see that it's not a 1:1 mapping. A single Windows time zone ID can map to several different IANA IDs, with one (territory 001) being deemed the primary mapping.

I'd expect that for the vast majority of the time, you'll see the same results between the two - but it's definitely not guaranteed for every instant in every time zone.

  • Related