24

I'm looking at building a form which prompts a user for their timezone. I've looked at the 'Google approach' and it seems to work pretty well. You first select a country from a drop down list and based on the selection, it populates the drop down list with the time zone options. I've search all over for a decent database with a country - timezone relationship but can't seem to find one. Does anyone know where i can find one?

dbr
  • 165,801
  • 69
  • 278
  • 343

8 Answers8

12

Using Noda Time and the .NET Framework Culture and TimeZoneInfo classes We managed to create a Json File with the Following entries which worked for us.

  • CountryName
  • 2LetterIsoCountryCode
  • 3LetterIsoCountryCode
  • IANATimezones
  • WindowsTimezones

Each Entry contains the list of available timezone for each country.

JsonFile here

Anestis Kivranoglou
  • 7,728
  • 5
  • 44
  • 47
7

Have you tried zoneinfo? http://www.twinsun.com/tz/tz-link.htm

"The public-domain time zone database 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. This database (often called tz or zoneinfo) is used by several implementations, including the GNU C Library used in GNU/Linux, FreeBSD, NetBSD, OpenBSD, Cygwin, DJGPP, AIX, Mac OS X, OpenVMS, Oracle Database, Solaris, Tru64, and UnixWare."

Hope that helps :)

Al.
  • 2,872
  • 2
  • 22
  • 34
7

The official mappings are found in the zone.tab file of the IANA time zone database.

There is also a newer version of this file, which covers cases where a time zone may be in use by more than one country. It is also in the IANA time zone database, and is called zone1970.tab.

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

Visit http://www.iana.org/time-zones/repository/tz-link.html

Download a Data file.

Check out the files iso3166.tab and zone.tab - between them they have everything you need.

James
  • 3,265
  • 4
  • 22
  • 28
2

timezonedb: https://timezonedb.com/

could also be mentioned. You can go to download page and find what format is most suitable for your project.

dyng
  • 2,854
  • 21
  • 24
1
[
{name: "Afghanistan", code: "AF", gmt: "(UTC+04:30)"},
{name: "Albania", code: "AL", gmt: "(UTC+01:00)"},
{name: "Algeria", code: "DZ", gmt: "(UTC+01:00)"},
{name: "Argentina", code: "AR", gmt: "(UTC-03:00)"},
{name: "Armenia", code: "AM", gmt: "(UTC+04:00)"},
{name: "Australia", code: "AU", gmt: "(UTC+11:00)"},
{name: "Austria", code: "AT", gmt: "(UTC+01:00)"},
{name: "Azerbaijan", code: "AZ", gmt: "(UTC+04:00)"},
{name: "Bahrain", code: "BH", gmt: "(UTC+03:00)"},
{name: "Bangladesh", code: "BD", gmt: "(UTC+06:00)"},
{name: "Belarus", code: "BY", gmt: "(UTC+03:00)"},
{name: "Belgium", code: "BE", gmt: "(UTC+01:00)"},
{name: "Belize", code: "BZ", gmt: "(UTC-06:00)"},
{name: "Bhutan", code: "BT", gmt: "(UTC+06:00)"},
{name: "Bolivia", code: "BO", gmt: "(UTC-04:00)"},
{name: "Bosnia and Herzegovina", code: "BA", gmt: "(UTC+01:00)"},
{name: "Botswana", code: "BW", gmt: "(UTC+02:00)"},
{name: "Brazil", code: "BR", gmt: "(UTC-02:00)"},
{name: "Brunei", code: "BN", gmt: "(UTC+08:00)"},
{name: "Bulgaria", code: "BG", gmt: "(UTC+02:00)"},
{name: "Cambodia", code: "KH", gmt: "(UTC+07:00)"},
{name: "Cameroon", code: "CM", gmt: "(UTC+01:00)"},
{name: "Canada", code: "CA", gmt: "(UTC-03:30)"},
{name: "Chile", code: "CL", gmt: "(UTC-04:00)"},
{name: "China", code: "CN", gmt: "(UTC+08:00)"},
{name: "Colombia", code: "CO", gmt: "(UTC-05:00)"},
{name: "Congo (DRC)", code: "CD", gmt: "(UTC+01:00)"},
{name: "Costa Rica", code: "CR", gmt: "(UTC-06:00)"},
{name: "Côte d’Ivoire", code: "CI", gmt: "(UTC+00:00)"},
{name: "Croatia", code: "HR", gmt: "(UTC+01:00)"},
{name: "Cuba", code: "CU", gmt: "(UTC-05:00)"},
{name: "Czech Republic", code: "CZ", gmt: "(UTC+01:00)"},
{name: "Denmark", code: "DK", gmt: "(UTC+01:00)"},
{name: "Djibouti", code: "DJ", gmt: "(UTC+03:00)"},
{name: "Dominican Republic", code: "DO", gmt: "(UTC-04:00)"},
{name: "Ecuador", code: "EC", gmt: "(UTC-05:00)"},
{name: "Egypt", code: "EG", gmt: "(UTC+02:00)"},
{name: "El Salvador", code: "SV", gmt: "(UTC-06:00)"},
{name: "Eritrea", code: "ER", gmt: "(UTC+03:00)"},
{name: "Estonia", code: "EE", gmt: "(UTC+02:00)"},
{name: "Ethiopia", code: "ET", gmt: "(UTC+03:00)"},
{name: "Faroe Islands", code: "FO", gmt: "(UTC+00:00)"},
{name: "Finland", code: "FI", gmt: "(UTC+02:00)"},
{name: "France", code: "FR", gmt: "(UTC+01:00)"},
{name: "Georgia", code: "GE", gmt: "(UTC+04:00)"},
{name: "Germany", code: "DE", gmt: "(UTC+01:00)"},
{name: "Greece", code: "GR", gmt: "(UTC+02:00)"},
{name: "Greenland", code: "GL", gmt: "(UTC-03:00)"},
{name: "Guatemala", code: "GT", gmt: "(UTC-06:00)"},
{name: "Haiti", code: "HT", gmt: "(UTC-05:00)"},
{name: "Honduras", code: "HN", gmt: "(UTC-06:00)"},
{name: "Hong Kong SAR", code: "HK", gmt: "(UTC+08:00)"},
{name: "Hungary", code: "HU", gmt: "(UTC+01:00)"},
{name: "Iceland", code: "IS", gmt: "(UTC+00:00)"},
{name: "India", code: "IN", gmt: "(UTC+05:30)"},
{name: "Indonesia", code: "ID", gmt: "(UTC+07:00)"},
{name: "Iran", code: "IR", gmt: "(UTC+03:30)"},
{name: "Iraq", code: "IQ", gmt: "(UTC+03:00)"},
{name: "Ireland", code: "IE", gmt: "(UTC+00:00)"},
{name: "Israel", code: "IL", gmt: "(UTC+02:00)"},
{name: "Italy", code: "IT", gmt: "(UTC+01:00)"},
{name: "Jamaica", code: "JM", gmt: "(UTC-05:00)"},
{name: "Japan", code: "JP", gmt: "(UTC+09:00)"},
{name: "Jordan", code: "JO", gmt: "(UTC+02:00)"},
{name: "Kazakhstan", code: "KZ", gmt: "(UTC+06:00)"},
{name: "Kenya", code: "KE", gmt: "(UTC+03:00)"},
{name: "Korea", code: "KR", gmt: "(UTC+09:00)"},
{name: "Kuwait", code: "KW", gmt: "(UTC+03:00)"},
{name: "Kyrgyzstan", code: "KG", gmt: "(UTC+06:00)"},
{name: "Laos", code: "LA", gmt: "(UTC+07:00)"},
{name: "Latvia", code: "LV", gmt: "(UTC+02:00)"},
{name: "Lebanon", code: "LB", gmt: "(UTC+02:00)"},
{name: "Libya", code: "LY", gmt: "(UTC+02:00)"},
{name: "Liechtenstein", code: "LI", gmt: "(UTC+01:00)"},
{name: "Lithuania", code: "LT", gmt: "(UTC+02:00)"},
{name: "Luxembourg", code: "LU", gmt: "(UTC+01:00)"},
{name: "Macao SAR", code: "MO", gmt: "(UTC+08:00)"},
{name: "Macedonia, FYRO", code: "MK", gmt: "(UTC+01:00)"},
{name: "Malaysia", code: "MY", gmt: "(UTC+08:00)"},
{name: "Maldives", code: "MV", gmt: "(UTC+05:00)"},
{name: "Mali", code: "ML", gmt: "(UTC+00:00)"},
{name: "Malta", code: "MT", gmt: "(UTC+01:00)"},
{name: "Mexico", code: "MX", gmt: "(UTC-06:00)"},
{name: "Moldova", code: "MD", gmt: "(UTC+02:00)"},
{name: "Monaco", code: "MC", gmt: "(UTC+01:00)"},
{name: "Mongolia", code: "MN", gmt: "(UTC+08:00)"},
{name: "Montenegro", code: "ME", gmt: "(UTC+01:00)"},
{name: "Morocco", code: "MA", gmt: "(UTC+00:00)"},
{name: "Myanmar", code: "MM", gmt: "(UTC+06:30)"},
{name: "Nepal", code: "NP", gmt: "(UTC+05:45)"},
{name: "Netherlands", code: "NL", gmt: "(UTC+01:00)"},
{name: "New Zealand", code: "NZ", gmt: "(UTC+12:00)"},
{name: "Nicaragua", code: "NI", gmt: "(UTC-06:00)"},
{name: "Nigeria", code: "NG", gmt: "(UTC+01:00)"},
{name: "Norway", code: "NO", gmt: "(UTC+01:00)"},
{name: "Oman", code: "OM", gmt: "(UTC+04:00)"},
{name: "Pakistan", code: "PK", gmt: "(UTC+05:00)"},
{name: "Panama", code: "PA", gmt: "(UTC-05:00)"},
{name: "Paraguay", code: "PY", gmt: "(UTC-04:00)"},
{name: "Peru", code: "PE", gmt: "(UTC-05:00)"},
{name: "Philippines", code: "PH", gmt: "(UTC+08:00)"},
{name: "Poland", code: "PL", gmt: "(UTC+01:00)"},
{name: "Portugal", code: "PT", gmt: "(UTC+00:00)"},
{name: "Puerto Rico", code: "PR", gmt: "(UTC-04:00)"},
{name: "Qatar", code: "QA", gmt: "(UTC+03:00)"},
{name: "Réunion", code: "RE", gmt: "(UTC+04:00)"},
{name: "Romania", code: "RO", gmt: "(UTC+02:00)"},
{name: "Russia", code: "RU", gmt: "(UTC+02:00)"},
{name: "Rwanda", code: "RW", gmt: "(UTC+02:00)"},
{name: "Saudi Arabia", code: "SA", gmt: "(UTC+03:00)"},
{name: "Senegal", code: "SN", gmt: "(UTC+00:00)"},
{name: "Serbia", code: "RS", gmt: "(UTC+01:00)"},
{name: "Singapore", code: "SG", gmt: "(UTC+08:00)"},
{name: "Slovakia", code: "SK", gmt: "(UTC+01:00)"},
{name: "Slovenia", code: "SI", gmt: "(UTC+01:00)"},
{name: "Somalia", code: "SO", gmt: "(UTC+03:00)"},
{name: "South Africa", code: "ZA", gmt: "(UTC+02:00)"},
{name: "Spain", code: "ES", gmt: "(UTC+01:00)"},
{name: "Sri Lanka", code: "LK", gmt: "(UTC+05:30)"},
{name: "Sweden", code: "SE", gmt: "(UTC+01:00)"},
{name: "Switzerland", code: "CH", gmt: "(UTC+01:00)"},
{name: "Syria", code: "SY", gmt: "(UTC+02:00)"},
{name: "Taiwan", code: "TW", gmt: "(UTC+08:00)"},
{name: "Tajikistan", code: "TJ", gmt: "(UTC+05:00)"},
{name: "Thailand", code: "TH", gmt: "(UTC+07:00)"},
{name: "Trinidad and Tobago", code: "TT", gmt: "(UTC-04:00)"},
{name: "Tunisia", code: "TN", gmt: "(UTC+01:00)"},
{name: "Turkey", code: "TR", gmt: "(UTC+02:00)"},
{name: "Turkmenistan", code: "TM", gmt: "(UTC+05:00)"},
{name: "Ukraine", code: "UA", gmt: "(UTC+02:00)"},
{name: "United Arab Emirates", code: "AE", gmt: "(UTC+04:00)"},
{name: "United Kingdom", code: "GB", gmt: "(UTC+00:00)"},
{name: "United States", code: "US", gmt: "(UTC-05:00)"},
{name: "Uruguay", code: "UY", gmt: "(UTC-03:00)"},
{name: "Uzbekistan", code: "UZ", gmt: "(UTC+05:00)"},
{name: "Venezuela", code: "VE", gmt: "(UTC-04:00)"},
{name: "Vietnam", code: "VN", gmt: "(UTC+07:00)"},
{name: "Yemen", code: "YE", gmt: "(UTC+03:00)"},
{name: "Zimbabwe", code: "ZW", gmt: "(UTC+02:00)"}
]
[
{name: "Afghanistan", code: "AF", gmt: "+04:30"},
{name: "Albania", code: "AL", gmt: "+01:00"},
{name: "Algeria", code: "DZ", gmt: "+01:00"},
{name: "Argentina", code: "AR", gmt: "-03:00"},
{name: "Armenia", code: "AM", gmt: "+04:00"},
{name: "Australia", code: "AU", gmt: "+11:00"},
{name: "Austria", code: "AT", gmt: "+01:00"},
{name: "Azerbaijan", code: "AZ", gmt: "+04:00"},
{name: "Bahrain", code: "BH", gmt: "+03:00"},
{name: "Bangladesh", code: "BD", gmt: "+06:00"},
{name: "Belarus", code: "BY", gmt: "+03:00"},
{name: "Belgium", code: "BE", gmt: "+01:00"},
{name: "Belize", code: "BZ", gmt: "-06:00"},
{name: "Bhutan", code: "BT", gmt: "+06:00"},
{name: "Bolivia", code: "BO", gmt: "-04:00"},
{name: "Bosnia and Herzegovina", code: "BA", gmt: "+01:00"},
{name: "Botswana", code: "BW", gmt: "+02:00"},
{name: "Brazil", code: "BR", gmt: "-02:00"},
{name: "Brunei", code: "BN", gmt: "+08:00"},
{name: "Bulgaria", code: "BG", gmt: "+02:00"},
{name: "Cambodia", code: "KH", gmt: "+07:00"},
{name: "Cameroon", code: "CM", gmt: "+01:00"},
{name: "Canada", code: "CA", gmt: "-03:30"},
{name: "Chile", code: "CL", gmt: "-04:00"},
{name: "China", code: "CN", gmt: "+08:00"},
{name: "Colombia", code: "CO", gmt: "-05:00"},
{name: "Congo (DRC)", code: "CD", gmt: "+01:00"},
{name: "Costa Rica", code: "CR", gmt: "-06:00"},
{name: "Côte d’Ivoire", code: "CI", gmt: "+00:00"},
{name: "Croatia", code: "HR", gmt: "+01:00"},
{name: "Cuba", code: "CU", gmt: "-05:00"},
{name: "Czech Republic", code: "CZ", gmt: "+01:00"},
{name: "Denmark", code: "DK", gmt: "+01:00"},
{name: "Djibouti", code: "DJ", gmt: "+03:00"},
{name: "Dominican Republic", code: "DO", gmt: "-04:00"},
{name: "Ecuador", code: "EC", gmt: "-05:00"},
{name: "Egypt", code: "EG", gmt: "+02:00"},
{name: "El Salvador", code: "SV", gmt: "-06:00"},
{name: "Eritrea", code: "ER", gmt: "+03:00"},
{name: "Estonia", code: "EE", gmt: "+02:00"},
{name: "Ethiopia", code: "ET", gmt: "+03:00"},
{name: "Faroe Islands", code: "FO", gmt: "+00:00"},
{name: "Finland", code: "FI", gmt: "+02:00"},
{name: "France", code: "FR", gmt: "+01:00"},
{name: "Georgia", code: "GE", gmt: "+04:00"},
{name: "Germany", code: "DE", gmt: "+01:00"},
{name: "Greece", code: "GR", gmt: "+02:00"},
{name: "Greenland", code: "GL", gmt: "-03:00"},
{name: "Guatemala", code: "GT", gmt: "-06:00"},
{name: "Haiti", code: "HT", gmt: "-05:00"},
{name: "Honduras", code: "HN", gmt: "-06:00"},
{name: "Hong Kong SAR", code: "HK", gmt: "+08:00"},
{name: "Hungary", code: "HU", gmt: "+01:00"},
{name: "Iceland", code: "IS", gmt: "+00:00"},
{name: "India", code: "IN", gmt: "+05:30"},
{name: "Indonesia", code: "ID", gmt: "+07:00"},
{name: "Iran", code: "IR", gmt: "+03:30"},
{name: "Iraq", code: "IQ", gmt: "+03:00"},
{name: "Ireland", code: "IE", gmt: "+00:00"},
{name: "Israel", code: "IL", gmt: "+02:00"},
{name: "Italy", code: "IT", gmt: "+01:00"},
{name: "Jamaica", code: "JM", gmt: "-05:00"},
{name: "Japan", code: "JP", gmt: "+09:00"},
{name: "Jordan", code: "JO", gmt: "+02:00"},
{name: "Kazakhstan", code: "KZ", gmt: "+06:00"},
{name: "Kenya", code: "KE", gmt: "+03:00"},
{name: "Korea", code: "KR", gmt: "+09:00"},
{name: "Kuwait", code: "KW", gmt: "+03:00"},
{name: "Kyrgyzstan", code: "KG", gmt: "+06:00"},
{name: "Laos", code: "LA", gmt: "+07:00"},
{name: "Latvia", code: "LV", gmt: "+02:00"},
{name: "Lebanon", code: "LB", gmt: "+02:00"},
{name: "Libya", code: "LY", gmt: "+02:00"},
{name: "Liechtenstein", code: "LI", gmt: "+01:00"},
{name: "Lithuania", code: "LT", gmt: "+02:00"},
{name: "Luxembourg", code: "LU", gmt: "+01:00"},
{name: "Macao SAR", code: "MO", gmt: "+08:00"},
{name: "Macedonia, FYRO", code: "MK", gmt: "+01:00"},
{name: "Malaysia", code: "MY", gmt: "+08:00"},
{name: "Maldives", code: "MV", gmt: "+05:00"},
{name: "Mali", code: "ML", gmt: "+00:00"},
{name: "Malta", code: "MT", gmt: "+01:00"},
{name: "Mexico", code: "MX", gmt: "-06:00"},
{name: "Moldova", code: "MD", gmt: "+02:00"},
{name: "Monaco", code: "MC", gmt: "+01:00"},
{name: "Mongolia", code: "MN", gmt: "+08:00"},
{name: "Montenegro", code: "ME", gmt: "+01:00"},
{name: "Morocco", code: "MA", gmt: "+00:00"},
{name: "Myanmar", code: "MM", gmt: "+06:30"},
{name: "Nepal", code: "NP", gmt: "+05:45"},
{name: "Netherlands", code: "NL", gmt: "+01:00"},
{name: "New Zealand", code: "NZ", gmt: "+12:00"},
{name: "Nicaragua", code: "NI", gmt: "-06:00"},
{name: "Nigeria", code: "NG", gmt: "+01:00"},
{name: "Norway", code: "NO", gmt: "+01:00"},
{name: "Oman", code: "OM", gmt: "+04:00"},
{name: "Pakistan", code: "PK", gmt: "+05:00"},
{name: "Panama", code: "PA", gmt: "-05:00"},
{name: "Paraguay", code: "PY", gmt: "-04:00"},
{name: "Peru", code: "PE", gmt: "-05:00"},
{name: "Philippines", code: "PH", gmt: "+08:00"},
{name: "Poland", code: "PL", gmt: "+01:00"},
{name: "Portugal", code: "PT", gmt: "+00:00"},
{name: "Puerto Rico", code: "PR", gmt: "-04:00"},
{name: "Qatar", code: "QA", gmt: "+03:00"},
{name: "Réunion", code: "RE", gmt: "+04:00"},
{name: "Romania", code: "RO", gmt: "+02:00"},
{name: "Russia", code: "RU", gmt: "+02:00"},
{name: "Rwanda", code: "RW", gmt: "+02:00"},
{name: "Saudi Arabia", code: "SA", gmt: "+03:00"},
{name: "Senegal", code: "SN", gmt: "+00:00"},
{name: "Serbia", code: "RS", gmt: "+01:00"},
{name: "Singapore", code: "SG", gmt: "+08:00"},
{name: "Slovakia", code: "SK", gmt: "+01:00"},
{name: "Slovenia", code: "SI", gmt: "+01:00"},
{name: "Somalia", code: "SO", gmt: "+03:00"},
{name: "South Africa", code: "ZA", gmt: "+02:00"},
{name: "Spain", code: "ES", gmt: "+01:00"},
{name: "Sri Lanka", code: "LK", gmt: "+05:30"},
{name: "Sweden", code: "SE", gmt: "+01:00"},
{name: "Switzerland", code: "CH", gmt: "+01:00"},
{name: "Syria", code: "SY", gmt: "+02:00"},
{name: "Taiwan", code: "TW", gmt: "+08:00"},
{name: "Tajikistan", code: "TJ", gmt: "+05:00"},
{name: "Thailand", code: "TH", gmt: "+07:00"},
{name: "Trinidad and Tobago", code: "TT", gmt: "-04:00"},
{name: "Tunisia", code: "TN", gmt: "+01:00"},
{name: "Turkey", code: "TR", gmt: "+02:00"},
{name: "Turkmenistan", code: "TM", gmt: "+05:00"},
{name: "Ukraine", code: "UA", gmt: "+02:00"},
{name: "United Arab Emirates", code: "AE", gmt: "+04:00"},
{name: "United Kingdom", code: "GB", gmt: "+00:00"},
{name: "United States", code: "US", gmt: "-05:00"},
{name: "Uruguay", code: "UY", gmt: "-03:00"},
{name: "Uzbekistan", code: "UZ", gmt: "+05:00"},
{name: "Venezuela", code: "VE", gmt: "-04:00"},
{name: "Vietnam", code: "VN", gmt: "+07:00"},
{name: "Yemen", code: "YE", gmt: "+03:00"},
{name: "Zimbabwe", code: "ZW", gmt: "+02:00"}
]
Ryan M
  • 18,333
  • 31
  • 67
  • 74
0

If a commercial solution is acceptable, you could check out the World Time Zone Database.

Justin Niessner
  • 242,243
  • 40
  • 408
  • 536
0

Ruby on Rails uses the following mapping for timezones: http://apidock.com/rails/TimeZone

Gav
  • 11,062
  • 7
  • 33
  • 35
  • 1
    unfortunately this does not have a direct mapping of Country to TimeZone! it still requires to know the city names – Tilo Jul 06 '11 at 23:23