3

Can time zone codes like "EST" be mapped cleanly to Olson time zones like "America/New_York"? If so, is that data openly available anywhere?

2

The IANA Time Zone Databases contains a list of timezones and their respective three letter abbreviations:

The Time Zone Database (often called tz or zoneinfo) contains code and data that represent the history of local time for many representative locations around the globe. It is updated periodically to reflect changes made by political bodies to time zone boundaries, UTC offsets, and daylight-saving rules. Its management procedure is documented in BCP 175: Procedures for Maintaining the Time Zone Database.

If you download the "data only distribution", you can open the individual files named after the different zones, like "africa", "australiasia" etc, but it's not easy to parse as the authors are very diligent in explaining how they decided how to define each time zone!

I mentioned the IANA Time Zone database, as Python's pytz library uses it as a data source. This library can convert from "America/New_York" to "EST", but please keep in mind that EST might be ambiguous internationally (like for instance, the East coast of Australia might refer to times as EST or AEST, just like in the US!).

You can use the library's tzinfo API to convert a timezone like

>>> tz = timezone('America/St_Johns')

into its three letter abbreviation, like

>>> tz.tzname(normal)
'NDT'

I wrote a short Python script as a gist showing that comma separated list, but it's very hacky!

EDIT: adding more information on how time zones can be read from the IANA time zone database, and link to script.

  • Thanks, I thought this would be in the TZ database but I couldn't find it. I'm actually just looking for the raw data source, do you happen to know which file this would be in? I did a string search for "EST", "GMT", et cetera, but I couldn't find a correspondence table that way. – shadowtalker Jan 28 '17 at 17:25
  • Sorry mate - I probably should have explained it a bit more - I added some more information to the answer - let me know what you think :-). – Anthony Joseph Jan 29 '17 at 3:29
1

Wikipedia has a list of maintained tz db time zones. While the three letter abbreviations (like "EST") are not included, "America/New_York", and the like are. You'll have to add an extra column for the three letter abbreviations:
List of tz Database Time Zones

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.