1

The problem is to define a correct timezone/offset for a certain location for a particular date in the past.

This is actually possible using Google Maps Timezone API service.

  1. I wonder if there any other available/ready to go solution (service/libs) capable of achieving the same result? Esp that would allow doing this without connection to external service?

  2. The second problem related to the first one is to get dates of changes of the timezone/offset of a particular location (or city). The dates when a particular location did change its timezone. Here I'm talking not about daylight savings which can be handle with IANA timezone db, but about cases when a location decides to go with another timezone from a certain moment.

It is interesting to hear someone who dealt with such kinds of problems and may advise the solution route.

WHITECOLOR
  • 24,996
  • 37
  • 121
  • 181
  • For the first question, that's been answered already [in this answer](https://stackoverflow.com/a/16086964/634824). For the second, that *is* what the IANA database is for, so I'm not sure what you are asking precisely there. Please give an example. – Matt Johnson-Pint Jan 19 '21 at 02:52
  • As I understand IANA database allow to to see when particular timezone changes its offset (daylight savings). The case i'm talking about: for example some city was related to XXX timezone, and after certain date it started to relate to another timezone YYY (not offset change, but the whole timezone changed due to some political decisions for example). Example in cities in Crimea before 2014 were in some Europe/XXX zone (where offset was +2 with daylight savings changes), and after certain events they are in another MSK (where offset +3 without daylight changes) time zone – WHITECOLOR Jan 19 '21 at 08:38

1 Answers1

2

As mentioned in the question comments, one can find options (including offline approaches) to resolving a latitude and longitude to an IANA time zone entry in this answer.

With regard to your second question, all changes to time zones in a given region are already represented in the IANA time zone database via its Zone and Rule entries. This includes daylight saving adjustments, changes in standard offset, and changes in the English abbreviation for the name of that time zone (when one is applicable).

In the case you described in the question comments, the entirety of time in Crimea is represented by the Europe/Simferopol zone and its associated rules. You can review the details here. It includes the 2014 changes you mention. If actually you have knowledge of some areas of Crimea whose local time differed from Simferopol, then you should submit that to the tz mailing list for discussion and debate.

In such cases, if verified and warranted, a "zone split" would occur. This results in the creation of a new IANA time zone identifier, using the most populous city in the region whose time differs from the existing region. When a new zone is created, the existing history is copied over from the previous zone. Only the LMT entry is adjusted to reflect the new location. Then either the new or old zone has the deviation applied, depending on which side has the change. A example would be in release 2018h when Asia/Qostanay was created, splitting away from Asia/Qyzylorda (both in Kazakhstan).

There are very few scenarios where the IANA TZDB doesn't cover changes in time zones in the way you are suggesting:

  • The deviation occurs only for dates prior to 1970.
  • If boundaries between regions are fluid, such as during a war or insurrection.
  • The accuracy of the information regarding the deviation is not verifiable or it is significantly disputed.
  • The deviation occurs in a region that is too small to warrant tracking its changes, such as small settlements or individual persons living in rural areas along borders.

Such things are described further in Theory and pragmatics of the tz code and data (the theory.html file in the TZDB). They are sometimes discussed and debated on the tz mailing list as well.

Lastly, keep in mind that the IANA TZDB doesn't actually try to define geopolitical borders. Such things are often disputed, and are more in the realm of map makers than time keepers. Thus, the lat/lon lookup is only as good as the map behind it. In most of the open source solutions offered in the list I referenced earlier, the boundaries are based on the data from Time Zone Boundary Builder project, which in turn uses Open Street Map (OSM) for most of its geopolitical boundaries. However, the online web services offered by Google, Microsoft, and others don't necessarily use that same map. Thus, it is possible for the same latitude and longitude to resolve to a different IANA time zone identifier depending on which data source you use.

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