-
-
Save nodesocket/3919205 to your computer and use it in GitHub Desktop.
<select name="timezone_offset" id="timezone-offset" class="span5"> | |
<option value="-12:00">(GMT -12:00) Eniwetok, Kwajalein</option> | |
<option value="-11:00">(GMT -11:00) Midway Island, Samoa</option> | |
<option value="-10:00">(GMT -10:00) Hawaii</option> | |
<option value="-09:50">(GMT -9:30) Taiohae</option> | |
<option value="-09:00">(GMT -9:00) Alaska</option> | |
<option value="-08:00">(GMT -8:00) Pacific Time (US & Canada)</option> | |
<option value="-07:00">(GMT -7:00) Mountain Time (US & Canada)</option> | |
<option value="-06:00">(GMT -6:00) Central Time (US & Canada), Mexico City</option> | |
<option value="-05:00">(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima</option> | |
<option value="-04:50">(GMT -4:30) Caracas</option> | |
<option value="-04:00">(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz</option> | |
<option value="-03:50">(GMT -3:30) Newfoundland</option> | |
<option value="-03:00">(GMT -3:00) Brazil, Buenos Aires, Georgetown</option> | |
<option value="-02:00">(GMT -2:00) Mid-Atlantic</option> | |
<option value="-01:00">(GMT -1:00) Azores, Cape Verde Islands</option> | |
<option value="+00:00" selected="selected">(GMT) Western Europe Time, London, Lisbon, Casablanca</option> | |
<option value="+01:00">(GMT +1:00) Brussels, Copenhagen, Madrid, Paris</option> | |
<option value="+02:00">(GMT +2:00) Kaliningrad, South Africa</option> | |
<option value="+03:00">(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg</option> | |
<option value="+03:50">(GMT +3:30) Tehran</option> | |
<option value="+04:00">(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi</option> | |
<option value="+04:50">(GMT +4:30) Kabul</option> | |
<option value="+05:00">(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent</option> | |
<option value="+05:50">(GMT +5:30) Bombay, Calcutta, Madras, New Delhi</option> | |
<option value="+05:75">(GMT +5:45) Kathmandu, Pokhara</option> | |
<option value="+06:00">(GMT +6:00) Almaty, Dhaka, Colombo</option> | |
<option value="+06:50">(GMT +6:30) Yangon, Mandalay</option> | |
<option value="+07:00">(GMT +7:00) Bangkok, Hanoi, Jakarta</option> | |
<option value="+08:00">(GMT +8:00) Beijing, Perth, Singapore, Hong Kong</option> | |
<option value="+08:75">(GMT +8:45) Eucla</option> | |
<option value="+09:00">(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk</option> | |
<option value="+09:50">(GMT +9:30) Adelaide, Darwin</option> | |
<option value="+10:00">(GMT +10:00) Eastern Australia, Guam, Vladivostok</option> | |
<option value="+10:50">(GMT +10:30) Lord Howe Island</option> | |
<option value="+11:00">(GMT +11:00) Magadan, Solomon Islands, New Caledonia</option> | |
<option value="+11:50">(GMT +11:30) Norfolk Island</option> | |
<option value="+12:00">(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka</option> | |
<option value="+12:75">(GMT +12:45) Chatham Islands</option> | |
<option value="+13:00">(GMT +13:00) Apia, Nukualofa</option> | |
<option value="+14:00">(GMT +14:00) Line Islands, Tokelau</option> | |
</select> |
I am using a nodejs/mysql project and wish to use this list, can someone please tell me if its more efficient (in terms of faster loading) of this complete list to load from a file or a mysql db?
thank you
<?php
$america_timezones_list = array(
'+00:00' => '(+00:00) Danmarkshavn',
'-01:00' => '(-01:00) Scoresbysund',
'-02:00' => '(-02:00) Noronha',
'-03:00' => '(-03:00) Montevideo',
'-03:00' => '(-03:00) Cayenne',
'-03:00' => '(-03:00) Paramaribo',
'-03:00' => '(-03:00) Miquelon',
'-03:00' => '(-03:00) Araguaina',
'-03:00' => '(-03:00) Santiago',
'-03:00' => '(-03:00) Punta Arenas',
'-03:00' => '(-03:00) Argentina/Buenos Aires',
'-03:00' => '(-03:00) Argentina/Catamarca',
'-03:00' => '(-03:00) Argentina/Mendoza',
'-03:00' => '(-03:00) Argentina/San Luis',
'-03:00' => '(-03:00) Argentina/San Juan',
'-03:00' => '(-03:00) Argentina/La Rioja',
'-03:00' => '(-03:00) Sao Paulo',
'-03:00' => '(-03:00) Asuncion',
'-03:00' => '(-03:00) Godthab',
'-03:00' => '(-03:00) Bahia',
'-03:00' => '(-03:00) Argentina/Rio Gallegos',
'-03:00' => '(-03:00) Argentina/Jujuy',
'-03:00' => '(-03:00) Argentina/Tucuman',
'-03:00' => '(-03:00) Belem',
'-03:00' => '(-03:00) Recife',
'-03:00' => '(-03:00) Fortaleza',
'-03:00' => '(-03:00) Santarem',
'-03:00' => '(-03:00) Argentina/Cordoba',
'-03:00' => '(-03:00) Maceio',
'-03:00' => '(-03:00) Argentina/Salta',
'-03:00' => '(-03:00) Argentina/Ushuaia',
'-03:30' => '(-03:30) St Johns',
'-04:00' => '(-04:00) St Barthelemy',
'-04:00' => '(-04:00) Port of Spain',
'-04:00' => '(-04:00) Santo Domingo',
'-04:00' => '(-04:00) Anguilla',
'-04:00' => '(-04:00) Tortola',
'-04:00' => '(-04:00) Thule',
'-04:00' => '(-04:00) Puerto Rico',
'-04:00' => '(-04:00) Barbados',
'-04:00' => '(-04:00) Porto Velho',
'-04:00' => '(-04:00) Moncton',
'-04:00' => '(-04:00) Martinique',
'-04:00' => '(-04:00) La Paz',
'-04:00' => '(-04:00) Cuiaba',
'-04:00' => '(-04:00) Antigua',
'-04:00' => '(-04:00) St Vincent',
'-04:00' => '(-04:00) Montserrat',
'-04:00' => '(-04:00) Boa Vista',
'-04:00' => '(-04:00) Marigot',
'-04:00' => '(-04:00) Manaus',
'-04:00' => '(-04:00) Kralendijk',
'-04:00' => '(-04:00) Goose Bay',
'-04:00' => '(-04:00) Dominica',
'-04:00' => '(-04:00) Campo Grande',
'-04:00' => '(-04:00) Lower Princes',
'-04:00' => '(-04:00) St Thomas',
'-04:00' => '(-04:00) Halifax',
'-04:00' => '(-04:00) St Lucia',
'-04:00' => '(-04:00) Caracas',
'-04:00' => '(-04:00) Guyana',
'-04:00' => '(-04:00) St Kitts',
'-04:00' => '(-04:00) Curacao',
'-04:00' => '(-04:00) Aruba',
'-04:00' => '(-04:00) Blanc-Sablon',
'-04:00' => '(-04:00) Glace Bay',
'-04:00' => '(-04:00) Grenada',
'-04:00' => '(-04:00) Guadeloupe',
'-05:00' => '(-05:00) Indiana/Marengo',
'-05:00' => '(-05:00) Indiana/Indianapolis',
'-05:00' => '(-05:00) Havana',
'-05:00' => '(-05:00) New York',
'-05:00' => '(-05:00) Indiana/Vincennes',
'-05:00' => '(-05:00) Jamaica',
'-05:00' => '(-05:00) Port-au-Prince',
'-05:00' => '(-05:00) Panama',
'-05:00' => '(-05:00) Nassau',
'-05:00' => '(-05:00) Thunder Bay',
'-05:00' => '(-05:00) Kentucky/Monticello',
'-05:00' => '(-05:00) Kentucky/Louisville',
'-05:00' => '(-05:00) Lima',
'-05:00' => '(-05:00) Atikokan',
'-05:00' => '(-05:00) Cancun',
'-05:00' => '(-05:00) Cayman',
'-05:00' => '(-05:00) Bogota',
'-05:00' => '(-05:00) Iqaluit',
'-05:00' => '(-05:00) Nipigon',
'-05:00' => '(-05:00) Pangnirtung',
'-05:00' => '(-05:00) Indiana/Vevay',
'-05:00' => '(-05:00) Indiana/Winamac',
'-05:00' => '(-05:00) Indiana/Petersburg',
'-05:00' => '(-05:00) Guayaquil',
'-05:00' => '(-05:00) Grand Turk',
'-05:00' => '(-05:00) Detroit',
'-05:00' => '(-05:00) Eirunepe',
'-05:00' => '(-05:00) Rio Branco',
'-05:00' => '(-05:00) Toronto',
'-06:00' => '(-06:00) Belize',
'-06:00' => '(-06:00) Indiana/Tell City',
'-06:00' => '(-06:00) Chicago',
'-06:00' => '(-06:00) Merida',
'-06:00' => '(-06:00) Managua',
'-06:00' => '(-06:00) Menominee',
'-06:00' => '(-06:00) Rankin Inlet',
'-06:00' => '(-06:00) Tegucigalpa',
'-06:00' => '(-06:00) Mexico City',
'-06:00' => '(-06:00) North Dakota/Center',
'-06:00' => '(-06:00) Rainy River',
'-06:00' => '(-06:00) Resolute',
'-06:00' => '(-06:00) Indiana/Knox',
'-06:00' => '(-06:00) El Salvador',
'-06:00' => '(-06:00) Costa Rica',
'-06:00' => '(-06:00) Matamoros',
'-06:00' => '(-06:00) Winnipeg',
'-06:00' => '(-06:00) Bahia Banderas',
'-06:00' => '(-06:00) Regina',
'-06:00' => '(-06:00) North Dakota/Beulah',
'-06:00' => '(-06:00) Swift Current',
'-06:00' => '(-06:00) Guatemala',
'-06:00' => '(-06:00) North Dakota/New Salem',
'-06:00' => '(-06:00) Monterrey',
'-07:00' => '(-07:00) Mazatlan',
'-07:00' => '(-07:00) Ojinaga',
'-07:00' => '(-07:00) Chihuahua',
'-07:00' => '(-07:00) Denver',
'-07:00' => '(-07:00) Phoenix',
'-07:00' => '(-07:00) Hermosillo',
'-07:00' => '(-07:00) Creston',
'-07:00' => '(-07:00) Yellowknife',
'-07:00' => '(-07:00) Inuvik',
'-07:00' => '(-07:00) Edmonton',
'-07:00' => '(-07:00) Dawson Creek',
'-07:00' => '(-07:00) Cambridge Bay',
'-07:00' => '(-07:00) Fort Nelson',
'-07:00' => '(-07:00) Boise',
'-08:00' => '(-08:00) Los Angeles',
'-08:00' => '(-08:00) Vancouver',
'-08:00' => '(-08:00) Tijuana',
'-08:00' => '(-08:00) Dawson',
'-08:00' => '(-08:00) Whitehorse',
'-09:00' => '(-09:00) Yakutat',
'-09:00' => '(-09:00) Juneau',
'-09:00' => '(-09:00) Nome',
'-09:00' => '(-09:00) Anchorage',
'-09:00' => '(-09:00) Sitka',
'-09:00' => '(-09:00) Metlakatla',
'-10:00' => '(-10:00) Adak'
);
Date/time APIs do not support daylight savings changes if you use timezones in GMT or UTC format.
Instead you should use timezones which provide location information. For example, you should use "Asia/Istanbul" instead of GMT+2
Where is Kyiv - the capital of Ukraine?
Thank you So much
Please listen to @mj1856 saying "Lists like these are dangerous". You will soon have errors in your code, if using these hardcoded lists.
@kamleshwebtech you don't PHP much, do you?
var_export($america_timezones_list);
RESULT:
array (
'+00:00' => '(+00:00) Danmarkshavn',
'-01:00' => '(-01:00) Scoresbysund',
'-02:00' => '(-02:00) Noronha',
'-03:00' => '(-03:00) Argentina/Ushuaia',
'-03:30' => '(-03:30) St Johns',
'-04:00' => '(-04:00) Guadeloupe',
'-05:00' => '(-05:00) Toronto',
'-06:00' => '(-06:00) Monterrey',
'-07:00' => '(-07:00) Boise',
'-08:00' => '(-08:00) Whitehorse',
'-09:00' => '(-09:00) Metlakatla',
'-10:00' => '(-10:00) Adak',
)
You'd probably be better off by switching keys and values.
Laravel seeder for time Zones
class TimeZoneSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
if (TimeZone::all()->count() > 0) return;
TimeZone::insert([
['id'=>1,'value'=>'-12:00', 'name'=>'(GMT -12:00) Eniwetok Kwajalein'],
['id'=>2, 'value'=>'-11:00', 'name'=>'(GMT -11:00) Midway Island, Samoa'],
['id'=>3, 'value'=>'-10:00', 'name'=>'(GMT -10:00) Hawaii'],
['id'=>4, 'value'=>'-09:50', 'name'=>'(GMT -9:30) Taiohae'],
['id'=>5, 'value'=>'-09:00', 'name'=>'(GMT -9:00) Alaska'],
['id'=>6, 'value'=>'-08:00', 'name'=>'(GMT -8:00) Pacific Time [US & Canada)'],
['id'=>7, 'value'=>'-07:00', 'name'=>'(GMT -7:00) Mountain Time [US & Canada)'],
['id'=>8, 'value'=>'-06:00', 'name'=>'(GMT -6:00) Central Time [US & Canada], Mexico City'],
['id'=>9, 'value'=>'-05:00', 'name'=>'(GMT -5:00) Eastern Time [US & Canada], Bogota, Lima'],
['id'=>10, 'value'=>'-04:50', 'name'=>'(GMT -4:30) Caracas'],
['id'=>11, 'value'=>'-04:00', 'name'=>'(GMT -4:00) Atlantic Time [Canada], Caracas, La Paz'],
['id'=>12, 'value'=>'-03:50', 'name'=>'(GMT -3:30) Newfoundland'],
['id'=>13, 'value'=>'-03:00', 'name'=>'(GMT -3:00) Brazil, Buenos Aires, Georgetown'],
['id'=>14, 'value'=>'-02:00', 'name'=>'(GMT -2:00) Mid-Atlantic'],
['id'=>15, 'value'=>'-01:00', 'name'=>'(GMT -1:00) Azores, Cape Verde Islands'],
['id'=>16, 'value'=>'+00:00', 'name'=>'(GMT) Western Europe Time, London, Lisbon, Casablanca'],
['id'=>17, 'value'=>'+01:00', 'name'=>'(GMT +1:00) Brussels, Copenhagen, Madrid, Paris'],
['id'=>18, 'value'=>'+02:00', 'name'=>'(GMT +2:00) Kaliningrad, South Africa'],
['id'=>19, 'value'=>'+03:00', 'name'=>'(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg'],
['id'=>20, 'value'=>'+03:50', 'name'=>'(GMT +3:30) Tehran'],
['id'=>21, 'value'=>'+04:00', 'name'=>'(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi'],
['id'=>22, 'value'=>'+04:50', 'name'=>'(GMT +4:30) Kabul'],
['id'=>23, 'value'=>'+05:00', 'name'=>'(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent'],
['id'=>24, 'value'=>'+05:50', 'name'=>'(GMT +5:30) Bombay, Calcutta, Madras, New Delhi'],
['id'=>25, 'value'=>'+05:75', 'name'=>'(GMT +5:45) Kathmandu, Pokhar'],
['id'=>26, 'value'=>'+06:00', 'name'=>'(GMT +6:00) Almaty, Dhaka, Colombo'],
['id'=>27, 'value'=>'+06:50', 'name'=>'(GMT +6:30) Yangon, Mandalay'],
['id'=>28, 'value'=>'+07:00', 'name'=>'(GMT +7:00) Bangkok, Hanoi, Jakarta'],
['id'=>29, 'value'=>'+08:00', 'name'=>'(GMT +8:00) Beijing, Perth, Singapore, Hong Kong'],
['id'=>30, 'value'=>'+08:75', 'name'=>'(GMT +8:45) Eucla'],
['id'=>31, 'value'=>'+09:00', 'name'=>'(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk'],
['id'=>32, 'value'=>'+09:50', 'name'=>'(GMT +9:30) Adelaide, Darwin'],
['id'=>33, 'value'=>'+10:00', 'name'=>'(GMT +10:00) Eastern Australia, Guam, Vladivostok'],
['id'=>34, 'value'=>'+10:50', 'name'=>'(GMT +10:30) Lord Howe Island'],
['id'=>35, 'value'=>'+11:00', 'name'=>'(GMT +11:00) Magadan, Solomon Islands, New Caledonia'],
['id'=>36, 'value'=>'+11:50', 'name'=>'(GMT +11:30) Norfolk Island'],
['id'=>37, 'value'=>'+12:00', 'name'=>'(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka'],
['id'=>38, 'value'=>'+12:75', 'name'=>'(GMT +12:45) Chatham Islands'],
['id'=>39, 'value'=>'+13:00', 'name'=>'(GMT +13:00) Apia, Nukualofa'],
['id'=>40, 'value'=>'+14:00', 'name'=>'(GMT +14:00) Line Islands, Tokelau'],
]);
}
}
@nodesocket - please delete this gist. It's encouraging a lot of bad implementations. See my previous comments above. Thanks.
I found this list extremely valuable thanks please do not delete
php code :D
define('TIME_ZONE', [ '-12:00' => '(GMT -12:00) Eniwetok, Kwajalein', '-11:00' => '(GMT -11:00) Midway Island, Samoa', '-10:00' => '(GMT -10:00) Hawaii', '-09:30' => '(GMT -9:30) Taiohae', '-09:00' => '(GMT -9:00) Alaska', '-08:00' => '(GMT -8:00) Pacific Time (US & Canada)', '-07:00' => '(GMT -7:00) Mountain Time (US & Canada)', '-06:00' => '(GMT -6:00) Central Time (US & Canada), Mexico City', '-05:00' => '(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima', '-04:30' => '(GMT -4:30) Caracas', '-04:00' => '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz', '-03:30' => '(GMT -3:30) Newfoundland', '-03:00' => '(GMT -3:00) Brazil, Buenos Aires, Georgetown', '-02:00' => '(GMT -2:00) Mid-Atlantic', '-01:00' => '(GMT -1:00) Azores, Cape Verde Islands', '+00:00' => '(GMT) Western Europe Time, London, Lisbon, Casablanca', '+01:00' => '(GMT +1:00) Brussels, Copenhagen, Madrid, Paris', '+02:00' => '(GMT +2:00) Kaliningrad, South Africa', '+03:00' => '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg', '+03:30' => '(GMT +3:30) Tehran', '+04:00' => '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi', '+04:30' => '(GMT +4:30) Kabul', '+05:00' => '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent', '+05:30' => '(GMT +5:30) Bombay, Calcutta, Madras, New Delhi', '+05:45' => '(GMT +5:45) Kathmandu, Pokhara', '+06:00' => '(GMT +6:00) Almaty, Dhaka, Colombo', '+06:30' => '(GMT +6:30) Yangon, Mandalay', '+07:00' => '(GMT +7:00) Bangkok, Hanoi, Jakarta', '+08:00' => '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong', '+08:45' => '(GMT +8:45) Eucla', '+09:00' => '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk', '+09:30' => '(GMT +9:30) Adelaide, Darwin', '+10:00' => '(GMT +10:00) Eastern Australia, Guam, Vladivostok', '+10:30' => '(GMT +10:30) Lord Howe Island', '+11:00' => '(GMT +11:00) Magadan, Solomon Islands, New Caledonia', '+11:30' => '(GMT +11:30) Norfolk Island', '+12:00' => '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka', '+12:45' => '(GMT +12:45) Chatham Islands', '+13:00' => '(GMT +13:00) Apia, Nukualofa', '+14:00' => '(GMT +14:00) Line Islands, Tokelau', ]);
This is extremely appreciated.
Warning! Please, do not use lists like this when trying to work correctly with time zones.
This is not a list of "All world timezones". It is not a complete list. It is not even time zones, just random values that may look like time zones, but are so far away from real time zones. Time zones can not be simplified to hardcoded lists like this.
Using lists similar to this for representing time zones will always fail.
Please read the important points in the comment from mattjohnsonpint (from 2017).
Yeah, @epursimuove is right, because eg (GMT -5:00) Eastern Time (US & Canada), Bogota, Lima is not true,
because Eastern Time in common has daylight saving time EST/EDT, but Bogota and Lima doesn't observe daylight time
Appreciate your input here @mj1856.