获取每个ISO国家/地区代码的最前沿时区

时间:2014-11-06 00:24:00

标签: python timezone

我正在尝试为每个国家/地区获取时区。如果该国家有多个时区,则应使用最前沿/最右侧的时区。例如,对于美国来说,它将是纽约/美国东部时间。

有没有办法使用Google的TimeZone API执行此操作? https://developers.google.com/maps/documentation/timezone/

1 个答案:

答案 0 :(得分:0)

您不需要API。只需使用IANA time zone database中的zone.tab文件。

许多国家/地区只有一个时区:

TJ  +3835+06848 Asia/Dushanbe
TK  -0922-17114 Pacific/Fakaofo
TL  -0833+12535 Asia/Dili
TM  +3757+05823 Asia/Ashgabat
TN  +3648+01011 Africa/Tunis

正如你所说,像美国这样的国家有很多时区:

US  +404251-0740023 America/New_York    Eastern Time
US  +421953-0830245 America/Detroit Eastern Time - Michigan - most locations
US  +381515-0854534 America/Kentucky/Louisville Eastern Time - Kentucky - Louisville area
US  +364947-0845057 America/Kentucky/Monticello Eastern Time - Kentucky - Wayne County
US  +394606-0860929 America/Indiana/Indianapolis    Eastern Time - Indiana - most locations
US  +384038-0873143 America/Indiana/Vincennes   Eastern Time - Indiana - Daviess, Dubois, Knox & Martin Counties
US  +410305-0863611 America/Indiana/Winamac Eastern Time - Indiana - Pulaski County
US  +382232-0862041 America/Indiana/Marengo Eastern Time - Indiana - Crawford County
US  +382931-0871643 America/Indiana/Petersburg  Eastern Time - Indiana - Pike County
US  +384452-0850402 America/Indiana/Vevay   Eastern Time - Indiana - Switzerland County
US  +415100-0873900 America/Chicago Central Time
US  +375711-0864541 America/Indiana/Tell_City   Central Time - Indiana - Perry County
US  +411745-0863730 America/Indiana/Knox    Central Time - Indiana - Starke County
US  +450628-0873651 America/Menominee   Central Time - Michigan - Dickinson, Gogebic, Iron & Menominee Counties
US  +470659-1011757 America/North_Dakota/Center Central Time - North Dakota - Oliver County
US  +465042-1012439 America/North_Dakota/New_Salem  Central Time - North Dakota - Morton County (except Mandan area)
US  +471551-1014640 America/North_Dakota/Beulah Central Time - North Dakota - Mercer County
US  +394421-1045903 America/Denver  Mountain Time
US  +433649-1161209 America/Boise   Mountain Time - south Idaho & east Oregon
US  +332654-1120424 America/Phoenix Mountain Standard Time - Arizona (except Navajo)
US  +340308-1181434 America/Los_Angeles Pacific Time
US  +550737-1313435 America/Metlakatla  Pacific Standard Time - Annette Island, Alaska
US  +611305-1495401 America/Anchorage   Alaska Time
US  +581807-1342511 America/Juneau  Alaska Time - Alaska panhandle
US  +571035-1351807 America/Sitka   Alaska Time - southeast Alaska panhandle
US  +593249-1394338 America/Yakutat Alaska Time - Alaska panhandle neck
US  +643004-1652423 America/Nome    Alaska Time - west Alaska
US  +515248-1763929 America/Adak    Aleutian Islands
US  +211825-1575130 Pacific/Honolulu    Hawaii

我不一定同意你的断言应该使用最右边的时区。但如果这就是你想要做的,你可以使用国内经济价值最大的那个。