Timezone Dropdown Select List

by Michael Khalili on September 27, 2009

HTML of a Dropdown list with all the time zones already added.

<select name="DropDownTimezone" id="DropDownTimezone">
      <option value="-12.0">(GMT -12:00) Eniwetok, Kwajalein</option>
      <option value="-11.0">(GMT -11:00) Midway Island, Samoa</option>
      <option value="-10.0">(GMT -10:00) Hawaii</option>
      <option value="-9.0">(GMT -9:00) Alaska</option>
      <option value="-8.0">(GMT -8:00) Pacific Time (US &amp; Canada)</option>
      <option value="-7.0">(GMT -7:00) Mountain Time (US &amp; Canada)</option>
      <option value="-6.0">(GMT -6:00) Central Time (US &amp; Canada), Mexico City</option>
      <option value="-5.0">(GMT -5:00) Eastern Time (US &amp; Canada), Bogota, Lima</option>
      <option value="-4.0">(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz</option>
      <option value="-3.5">(GMT -3:30) Newfoundland</option>
      <option value="-3.0">(GMT -3:00) Brazil, Buenos Aires, Georgetown</option>
      <option value="-2.0">(GMT -2:00) Mid-Atlantic</option>
      <option value="-1.0">(GMT -1:00 hour) Azores, Cape Verde Islands</option>
      <option value="0.0">(GMT) Western Europe Time, London, Lisbon, Casablanca</option>
      <option value="1.0">(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris</option>
      <option value="2.0">(GMT +2:00) Kaliningrad, South Africa</option>
      <option value="3.0">(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg</option>
      <option value="3.5">(GMT +3:30) Tehran</option>
      <option value="4.0">(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi</option>
      <option value="4.5">(GMT +4:30) Kabul</option>
      <option value="5.0">(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent</option>
      <option value="5.5">(GMT +5:30) Bombay, Calcutta, Madras, New Delhi</option>
      <option value="5.75">(GMT +5:45) Kathmandu</option>
      <option value="6.0">(GMT +6:00) Almaty, Dhaka, Colombo</option>
      <option value="7.0">(GMT +7:00) Bangkok, Hanoi, Jakarta</option>
      <option value="8.0">(GMT +8:00) Beijing, Perth, Singapore, Hong Kong</option>
      <option value="9.0">(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk</option>
      <option value="9.5">(GMT +9:30) Adelaide, Darwin</option>
      <option value="10.0">(GMT +10:00) Eastern Australia, Guam, Vladivostok</option>
      <option value="11.0">(GMT +11:00) Magadan, Solomon Islands, New Caledonia</option>
      <option value="12.0">(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka</option>
</select>
You should share this page:
  • email
  • HackerNews
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Mixx
  • Sphinn
  • Yahoo! Buzz
  • Print
  • Thanks a lot! Timesavers like this are much, MUCH appreciated. Used this in my current project.
  • Thanks a lot! Used in my current project :)
  • Todd Cesere
    *sigh* php version with floats for keys is probably better, sorry for the noise

    $timeZones = array(
    5.0 => '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent',
    4.5 => '(GMT +4:30) Kabul',
    4.0 => '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi',
    3.5 => '(GMT +3:30) Tehran',
    3.0 => '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg',
    2.0 => '(GMT +2:00) Kaliningrad, South Africa',
    1.0 => '(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris',
    -12.0 => '(GMT -12:00) Eniwetok, Kwajalein',
    -11.0 => '(GMT -11:00) Midway Island, Samoa',
    -10.0 => '(GMT -10:00) Hawaii',
    -9.0 => '(GMT -9:00) Alaska',
    -8.0 => '(GMT -8:00) Pacific Time (US & Canada)',
    -7.0 => '(GMT -7:00) Mountain Time (US & Canada)',
    -6.0 => '(GMT -6:00) Central Time (US & Canada), Mexico City',
    -5.0 => '(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima',
    -4.0 => '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz',
    -3.5 => '(GMT -3:30) Newfoundland',
    -3.0 => '(GMT -3:00) Brazil, Buenos Aires, Georgetown',
    -2.0 => '(GMT -2:00) Mid-Atlantic',
    -1.0 => '(GMT -1:00 hour) Azores, Cape Verde Islands',
    0.0 => '(GMT) Western Europe Time, London, Lisbon, Casablanca',
    5.5 => '(GMT +5:30) Bombay, Calcutta, Madras, New Delhi',
    5.75 => '(GMT +5:45) Kathmandu',
    6.0 => '(GMT +6:00) Almaty, Dhaka, Colombo',
    7.0 => '(GMT +7:00) Bangkok, Hanoi, Jakarta',
    8.0 => '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong',
    9.0 => '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk',
    9.5 => '(GMT +9:30) Adelaide, Darwin',
    10.0 => '(GMT +10:00) Eastern Australia, Guam, Vladivostok',
    11.0 => '(GMT +11:00) Magadan, Solomon Islands, New Caledonia',
    12.0 => '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka',
    );
  • Todd Cesere
    And the php array version:


    $timeZones = array(
    '5.0' => '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent',
    '4.5' => '(GMT +4:30) Kabul',
    '4.0' => '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi',
    '3.5' => '(GMT +3:30) Tehran',
    '3.0' => '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg',
    '2.0' => '(GMT +2:00) Kaliningrad, South Africa',
    '1.0' => '(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris',
    '-12.0' => '(GMT -12:00) Eniwetok, Kwajalein',
    '-11.0' => '(GMT -11:00) Midway Island, Samoa',
    '-10.0' => '(GMT -10:00) Hawaii',
    '-9.0' => '(GMT -9:00) Alaska',
    '-8.0' => '(GMT -8:00) Pacific Time (US & Canada)',
    '-7.0' => '(GMT -7:00) Mountain Time (US & Canada)',
    '-6.0' => '(GMT -6:00) Central Time (US & Canada), Mexico City',
    '-5.0' => '(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima',
    '-4.0' => '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz',
    '-3.5' => '(GMT -3:30) Newfoundland',
    '-3.0' => '(GMT -3:00) Brazil, Buenos Aires, Georgetown',
    '-2.0' => '(GMT -2:00) Mid-Atlantic',
    '-1.0' => '(GMT -1:00 hour) Azores, Cape Verde Islands',
    '0.0' => '(GMT) Western Europe Time, London, Lisbon, Casablanca',
    '5.5' => '(GMT +5:30) Bombay, Calcutta, Madras, New Delhi',
    '5.75' => '(GMT +5:45) Kathmandu',
    '6.0' => '(GMT +6:00) Almaty, Dhaka, Colombo',
    '7.0' => '(GMT +7:00) Bangkok, Hanoi, Jakarta',
    '8.0' => '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong',
    '9.0' => '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk',
    '9.5' => '(GMT +9:30) Adelaide, Darwin',
    '10.0' => '(GMT +10:00) Eastern Australia, Guam, Vladivostok',
    '11.0' => '(GMT +11:00) Magadan, Solomon Islands, New Caledonia',
    '12.0' => '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka',
    );
  • AHHP
    Thanks.
  • Thanks for the time saver Michael!
  • Matt
    Thanks. A great time saver.
    Remember to add a 'SELECTED' option to set it to your default timezone, if required!
  • Ryan
    Thanks for this. I needed to put the values into an SQL database, wow PITA. So here's the sql if you need to also:

    --
    -- Table structure for table `timezones`
    --

    CREATE TABLE `timezones` (
    `GMT` varchar(6) NOT NULL,
    `name` varchar(75) NOT NULL,
    UNIQUE KEY `GMT` (`GMT`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

    --
    -- Dumping data for table `timezones`
    --

    INSERT INTO `timezones` (`GMT`, `name`) VALUES
    ('5.0', '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent'),
    ('4.5', '(GMT +4:30) Kabul'),
    ('4.0', '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi'),
    ('3.5', '(GMT +3:30) Tehran'),
    ('3.0', '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg'),
    ('2.0', '(GMT +2:00) Kaliningrad, South Africa'),
    ('1.0', '(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris'),
    ('-12.0', '(GMT -12:00) Eniwetok, Kwajalein'),
    ('-11.0', '(GMT -11:00) Midway Island, Samoa'),
    ('-10.0', '(GMT -10:00) Hawaii'),
    ('-9.0', '(GMT -9:00) Alaska'),
    ('-8.0', '(GMT -8:00) Pacific Time (US & Canada)'),
    ('-7.0', '(GMT -7:00) Mountain Time (US & Canada)'),
    ('-6.0', '(GMT -6:00) Central Time (US & Canada), Mexico City'),
    ('-5.0', '(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima'),
    ('-4.0', '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz'),
    ('-3.5', '(GMT -3:30) Newfoundland'),
    ('-3.0', '(GMT -3:00) Brazil, Buenos Aires, Georgetown'),
    ('-2.0', '(GMT -2:00) Mid-Atlantic'),
    ('-1.0', '(GMT -1:00 hour) Azores, Cape Verde Islands'),
    ('0.0', '(GMT) Western Europe Time, London, Lisbon, Casablanca'),
    ('5.5', '(GMT +5:30) Bombay, Calcutta, Madras, New Delhi'),
    ('5.75', '(GMT +5:45) Kathmandu'),
    ('6.0', '(GMT +6:00) Almaty, Dhaka, Colombo'),
    ('7.0', '(GMT +7:00) Bangkok, Hanoi, Jakarta'),
    ('8.0', '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong'),
    ('9.0', '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk'),
    ('9.5', '(GMT +9:30) Adelaide, Darwin'),
    ('10.0', '(GMT +10:00) Eastern Australia, Guam, Vladivostok'),
    ('11.0', '(GMT +11:00) Magadan, Solomon Islands, New Caledonia'),
    ('12.0', '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka');
  • JB
    I might as well give out the Java HashMap version of this excellent timezone list:

    LinkedHashMap<String, String> timeZoneMap = new LinkedHashMap<String, String>(31);
    timeZoneMap.put("5.0", "(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent");
    timeZoneMap.put("4.5", "(GMT +4:30) Kabul");
    timeZoneMap.put("4.0", "(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi");
    timeZoneMap.put("3.5", "(GMT +3:30) Tehran");
    timeZoneMap.put("3.0", "(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg");
    timeZoneMap.put("2.0", "(GMT +2:00) Kaliningrad, South Africa");
    timeZoneMap.put("1.0", "(GMT +1:00) Brussels, Copenhagen, Madrid, Paris");
    timeZoneMap.put("-12.0", "(GMT -12:00) Eniwetok, Kwajalein");
    timeZoneMap.put("-11.0", "(GMT -11:00) Midway Island, Samoa");
    timeZoneMap.put("-10.0", "(GMT -10:00) Hawaii");
    timeZoneMap.put("-9.0", "(GMT -9:00) Alaska");
    timeZoneMap.put("-8.0", "(GMT -8:00) Pacific Time (US & Canada)");
    timeZoneMap.put("-7.0", "(GMT -7:00) Mountain Time (US & Canada)");
    timeZoneMap.put("-6.0", "(GMT -6:00) Central Time (US & Canada), Mexico City");
    timeZoneMap.put("-5.0", "(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima");
    timeZoneMap.put("-4.0", "(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz");
    timeZoneMap.put("-3.5", "(GMT -3:30) Newfoundland");
    timeZoneMap.put("-3.0", "(GMT -3:00) Brazil, Buenos Aires, Georgetown");
    timeZoneMap.put("-2.0", "(GMT -2:00) Mid-Atlantic");
    timeZoneMap.put("-1.0", "(GMT -1:00 hour) Azores, Cape Verde Islands");
    timeZoneMap.put("0.0", "(GMT) Western Europe Time, London, Lisbon, Casablanca");
    timeZoneMap.put("5.5", "(GMT +5:30) Bombay, Calcutta, Madras, New Delhi");
    timeZoneMap.put("5.75", "(GMT +5:45) Kathmandu");
    timeZoneMap.put("6.0", "(GMT +6:00) Almaty, Dhaka, Colombo");
    timeZoneMap.put("7.0", "(GMT +7:00) Bangkok, Hanoi, Jakarta");
    timeZoneMap.put("8.0", "(GMT +8:00) Beijing, Perth, Singapore, Hong Kong");
    timeZoneMap.put("9.0", "(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk");
    timeZoneMap.put("9.5", "(GMT +9:30) Adelaide, Darwin");
    timeZoneMap.put("10.0", "(GMT +10:00) Eastern Australia, Guam, Vladivostok");
    timeZoneMap.put("11.0", "(GMT +11:00) Magadan, Solomon Islands, New Caledonia");
    timeZoneMap.put("12.0", "(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka");
  • Thank you Ryan and Michael. Both of you saved my time..
  • jefft
    thanks! you're the man. just what I needed.
  • shireev
    Hi Michael,
    This is excellent, very useful and just what I wanted.
    I don't really know much about programming so could you please tell me if this code is programmed to change when times change back or forward. For example; your code currently show London time agains South Africa as GMT +2. In summer time, when London times becomes BST, it will be GMT +1 in South Africa.

    My question is whether the list will automatically change to GMT +1 or if we will have to do something when the clocks change.

    I would be most grateful for your reply.

    Kind regards,
    Vicky
  • This is just a static HTML dropdown. There's no programming or changes involved. It will stay the same no matter what you do.

    What you're probably looking for is JavaScript that will detect the current timezone along with Daylight Saving Time. Have a look at two other functions I created that do just that.

    http://www.michaelapproved.com/articles/timezon...
    http://www.michaelapproved.com/articles/dayligh...
  • xoundboy
    thanks very much - this is exactly what I was looking for for my callback form http://www.teflworldwideprague.com/callback.html
  • Thank you :)
  • Name
    Thank you very useful
blog comments powered by Disqus

Previous post: Daylight Saving Time (DST) Detect

Next post: Object Position (Top and Left Offset) on a Page