Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to make a PHP function that returns the UTC timezone for a given airport code (IATA/FAA).

What the function should do is something like this:

echo getTimezoneFromAirportCode("CPH"); // +1
echo getTimezoneFromAirportCode("CXI"); // +14

To make this function I need a list of all aiport codes and their timezones.

By searching a bit I found this list: https://sourceforge.net/p/openflights/code/HEAD/tree/openflights/data/airports.dat?format=raw (Source: http://openflights.org/data.html)

After looking up a couple of airport codes in the list I found out that some of the data was incorrect. For instance it lists CXI to be in the UTC -12 timezone - which according to this page is incorrect.

Does any of you know a public list that provides the data needed to make the getTimezoneFromAirportCode function?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
622 views
Welcome To Ask or Share your Answers For Others

1 Answer

Seeing as the question is still open I'd like to point to my very own timezone map files. For your particular purpose, the IATA tzmap seems perfect:

https://raw.github.com/hroptatyr/dateutils/tzmaps/iata.tzmap

Obviously, you'd have to snarf the offset in question (it depends on a date as it might change over time) from the zoneinfo files, e.g. with zdump(1).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...