Home » Php » date – Setting timezone to UTC (0) in PHP

date – Setting timezone to UTC (0) in PHP

Posted by: admin April 23, 2020 Leave a comment

Questions:

Why does this work?

date_default_timezone_set('Australia/Currie');

But this doesn’t seem to take any effect at all?

date_default_timezone_set('UTC');

This value doesn’t change when setting the timezone to UTC:

echo date('Y-m-d H:i:s', time());

I’m using php 5.2.13, and the timezone of my server is:

$server_tz = date_default_timezone_get();
echo $server_tz; //outputs 'America/Guayaquil'

This is the original code:

echo time() . "<br>\n";
date_default_timezone_set('UTC');
echo time() . "<br>\n";

Output:

1317235130
1317235130
How to&Answers:

The problem is that you’re displaying time(), which is a UNIX timestamp based on GMT/UTC. That’s why it doesn’t change. date() on the other hand, formats the time based on that timestamp.

A timestamp is the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

echo date('Y-m-d H:i:s T', time()) . "<br>\n";
date_default_timezone_set('UTC');
echo date('Y-m-d H:i:s T', time()) . "<br>\n";

Answer:

UTC is definitely a valid timezone. It is simply an abbreviation for Coordinated Universal Time. In addition, remember that date_default_timezone_set accepts one of the following values:

 $timezones=array( "America/Adak", "America/Argentina/Buenos_Aires", "America/Argentina/La_Rioja", "America/Argentina/San_Luis", "America/Atikokan", "America/Belem", "America/Boise", "America/Caracas", "America/Chihuahua", "America/Cuiaba", "America/Denver", "America/El_Salvador", "America/Godthab", "America/Guatemala", "America/Hermosillo", "America/Indiana/Tell_City", "America/Inuvik", "America/Kentucky/Louisville", "America/Lima", "America/Managua", "America/Mazatlan", "America/Mexico_City", "America/Montreal", "America/Nome", "America/Ojinaga", "America/Port-au-Prince", "America/Rainy_River", "America/Rio_Branco", "America/Santo_Domingo", "America/St_Barthelemy", "America/St_Vincent", "America/Tijuana", "America/Whitehorse", "America/Anchorage", "America/Argentina/Catamarca", "America/Argentina/Mendoza", "America/Argentina/Tucuman", "America/Atka", "America/Belize", "America/Buenos_Aires", "America/Catamarca", "America/Coral_Harbour", "America/Curacao", "America/Detroit", "America/Ensenada", "America/Goose_Bay", "America/Guayaquil", "America/Indiana/Indianapolis", "America/Indiana/Vevay", "America/Iqaluit", "America/Kentucky/Monticello", "America/Los_Angeles", "America/Manaus", "America/Mendoza", "America/Miquelon", "America/Montserrat", "America/Noronha", "America/Panama", "America/Port_of_Spain", "America/Rankin_Inlet", "America/Rosario", "America/Sao_Paulo", "America/St_Johns", "America/Swift_Current", "America/Toronto", "America/Winnipeg", "America/Anguilla", "America/Argentina/ComodRivadavia", "America/Argentina/Rio_Gallegos", "America/Argentina/Ushuaia", "America/Bahia", "America/Blanc-Sablon", "America/Cambridge_Bay", "America/Cayenne", "America/Cordoba", "America/Danmarkshavn", "America/Dominica", "America/Fort_Wayne", "America/Grand_Turk", "America/Guyana", "America/Indiana/Knox", "America/Indiana/Vincennes", "America/Jamaica", "America/Knox_IN", "America/Louisville", "America/Marigot", "America/Menominee", "America/Moncton", "America/Nassau", "America/North_Dakota/Beulah", "America/Pangnirtung", "America/Porto_Acre", "America/Recife", "America/Santa_Isabel", "America/Scoresbysund", "America/St_Kitts", "America/Tegucigalpa", "America/Tortola", "America/Yakutat", "America/Antigua", "America/Argentina/Cordoba", "America/Argentina/Salta", "America/Aruba", "America/Bahia_Banderas", "America/Boa_Vista", "America/Campo_Grande", "America/Cayman", "America/Costa_Rica", "America/Dawson", "America/Edmonton", "America/Fortaleza", "America/Grenada", "America/Halifax", "America/Indiana/Marengo", "America/Indiana/Winamac", "America/Jujuy", "America/Kralendijk", "America/Lower_Princes", "America/Martinique", "America/Merida", "America/Monterrey", "America/New_York", "America/North_Dakota/Center", "America/Paramaribo", "America/Porto_Velho", "America/Regina", "America/Santarem", "America/Shiprock", "America/St_Lucia", "America/Thule", "America/Vancouver", "America/Yellowknife", "America/Araguaina", "America/Argentina/Jujuy", "America/Argentina/San_Juan", "America/Asuncion", "America/Barbados", "America/Bogota", "America/Cancun", "America/Chicago", "America/Creston", "America/Dawson_Creek", "America/Eirunepe", "America/Glace_Bay", "America/Guadeloupe", "America/Havana", "America/Indiana/Petersburg", "America/Indianapolis", "America/Juneau", "America/La_Paz", "America/Maceio", "America/Matamoros", "America/Metlakatla", "America/Montevideo", "America/Nipigon", "America/North_Dakota/New_Salem", "America/Phoenix", "America/Puerto_Rico", "America/Resolute", "America/Santiago", "America/Sitka", "America/St_Thomas", "America/Thunder_Bay", "America/Virgin", "Indian/Antananarivo", "Indian/Kerguelen", "Indian/Reunion", "Australia/ACT", "Australia/Currie", "Australia/Lindeman", "Australia/Perth", "Australia/Victoria", "Europe/Amsterdam", "Europe/Berlin", "Europe/Chisinau", "Europe/Helsinki", "Europe/Kiev", "Europe/Madrid", "Europe/Moscow", "Europe/Prague", "Europe/Sarajevo", "Europe/Tallinn", "Europe/Vatican", "Europe/Zagreb", "Pacific/Apia", "Pacific/Efate", "Pacific/Galapagos", "Pacific/Johnston", "Pacific/Marquesas", "Pacific/Noumea", "Pacific/Ponape", "Pacific/Tahiti", "Pacific/Wallis", "Indian/Chagos", "Indian/Mahe", "Australia/Adelaide", "Australia/Darwin", "Australia/Lord_Howe", "Australia/Queensland", "Australia/West", "Europe/Andorra", "Europe/Bratislava", "Europe/Copenhagen", "Europe/Isle_of_Man", "Europe/Lisbon", "Europe/Malta", "Europe/Nicosia", "Europe/Riga", "Europe/Simferopol", "Europe/Tirane", "Europe/Vienna", "Europe/Zaporozhye", "Pacific/Auckland", "Pacific/Enderbury", "Pacific/Gambier", "Pacific/Kiritimati", "Pacific/Midway", "Pacific/Pago_Pago", "Pacific/Port_Moresby", "Pacific/Tarawa", "Pacific/Yap", "Africa/Abidjan", "Africa/Asmera", "Africa/Blantyre", "Africa/Ceuta", "Africa/Douala", "Africa/Johannesburg", "Africa/Kinshasa", "Africa/Lubumbashi", "Africa/Mbabane", "Africa/Niamey", "Africa/Timbuktu", "Africa/Accra", "Africa/Bamako", "Africa/Brazzaville", "Africa/Conakry", "Africa/El_Aaiun", "Africa/Juba", "Africa/Lagos", "Africa/Lusaka", "Africa/Mogadishu", "Africa/Nouakchott", "Africa/Tripoli", "Africa/Addis_Ababa", "Africa/Bangui", "Africa/Bujumbura", "Africa/Dakar", "Africa/Freetown", "Africa/Kampala", "Africa/Libreville", "Africa/Malabo", "Africa/Monrovia", "Africa/Ouagadougou", "Africa/Tunis", "Africa/Algiers", "Africa/Banjul", "Africa/Cairo", "Africa/Dar_es_Salaam", "Africa/Gaborone", "Africa/Khartoum", "Africa/Lome", "Africa/Maputo", "Africa/Nairobi", "Africa/Porto-Novo", "Africa/Windhoek", "Africa/Asmara", "Africa/Bissau", "Africa/Casablanca", "Africa/Djibouti", "Africa/Harare", "Africa/Kigali", "Africa/Luanda", "Africa/Maseru", "Africa/Ndjamena", "Africa/Sao_Tome", "Atlantic/Azores", "Atlantic/Faroe", "Atlantic/St_Helena", "Atlantic/Bermuda", "Atlantic/Jan_Mayen", "Atlantic/Stanley", "Atlantic/Canary", "Atlantic/Madeira", "Atlantic/Cape_Verde", "Atlantic/Reykjavik", "Atlantic/Faeroe", "Atlantic/South_Georgia", "Asia/Aden", "Asia/Aqtobe", "Asia/Baku", "Asia/Calcutta", "Asia/Dacca", "Asia/Dushanbe", "Asia/Hong_Kong", "Asia/Jayapura", "Asia/Kashgar", "Asia/Kuala_Lumpur", "Asia/Magadan", "Asia/Novokuznetsk", "Asia/Pontianak", "Asia/Riyadh", "Asia/Shanghai", "Asia/Tehran", "Asia/Ujung_Pandang", "Asia/Vladivostok", "Asia/Almaty", "Asia/Ashgabat", "Asia/Bangkok", "Asia/Choibalsan", "Asia/Damascus", "Asia/Gaza", "Asia/Hovd", "Asia/Jerusalem", "Asia/Kathmandu", "Asia/Kuching", "Asia/Makassar", "Asia/Novosibirsk", "Asia/Pyongyang", "Asia/Saigon", "Asia/Singapore", "Asia/Tel_Aviv", "Asia/Ulaanbaatar", "Asia/Yakutsk", "Asia/Amman", "Asia/Ashkhabad", "Asia/Beirut", "Asia/Chongqing", "Asia/Dhaka", "Asia/Harbin", "Asia/Irkutsk", "Asia/Kabul", "Asia/Katmandu", "Asia/Kuwait", "Asia/Manila", "Asia/Omsk", "Asia/Qatar", "Asia/Sakhalin", "Asia/Taipei", "Asia/Thimbu", "Asia/Ulan_Bator", "Asia/Yekaterinburg", "Asia/Anadyr", "Asia/Baghdad", "Asia/Bishkek", "Asia/Chungking", "Asia/Dili", "Asia/Hebron", "Asia/Istanbul", "Asia/Kamchatka", "Asia/Kolkata", "Asia/Macao", "Asia/Muscat", "Asia/Oral", "Asia/Qyzylorda", "Asia/Samarkand", "Asia/Tashkent", "Asia/Thimphu", "Asia/Urumqi", "Asia/Yerevan", "Asia/Aqtau", "Asia/Bahrain", "Asia/Brunei", "Asia/Colombo", "Asia/Dubai", "Asia/Ho_Chi_Minh", "Asia/Jakarta", "Asia/Karachi", "Asia/Krasnoyarsk", "Asia/Macau", "Asia/Nicosia", "Asia/Phnom_Penh", "Asia/Rangoon", "Asia/Seoul", "Asia/Tbilisi", "Asia/Tokyo", "Asia/Vientiane", "Australia/Canberra", "Australia/LHI", "Australia/NSW", "Australia/Tasmania", "Australia/Broken_Hill", "Australia/Hobart", "Australia/North", "Australia/Sydney", "Pacific/Chuuk", "Pacific/Fiji", "Pacific/Guam", "Pacific/Kwajalein", "Pacific/Niue", "Pacific/Pitcairn", "Pacific/Saipan", "Pacific/Truk", "Pacific/Chatham", "Pacific/Fakaofo", "Pacific/Guadalcanal", "Pacific/Kosrae", "Pacific/Nauru", "Pacific/Palau", "Pacific/Rarotonga", "Pacific/Tongatapu", "Pacific/Easter", "Pacific/Funafuti", "Pacific/Honolulu", "Pacific/Majuro", "Pacific/Norfolk", "Pacific/Pohnpei", "Pacific/Samoa", "Pacific/Wake", "Antarctica/Casey", "Antarctica/McMurdo", "Antarctica/Vostok", "Antarctica/Davis", "Antarctica/Palmer", "Antarctica/DumontDUrville", "Antarctica/Rothera", "Antarctica/Macquarie", "Antarctica/South_Pole", "Antarctica/Mawson", "Antarctica/Syowa", "Arctic/Longyearbyen", "Europe/Athens", "Europe/Brussels", "Europe/Dublin", "Europe/Istanbul", "Europe/Ljubljana", "Europe/Mariehamn", "Europe/Oslo", "Europe/Rome", "Europe/Skopje", "Europe/Tiraspol", "Europe/Vilnius", "Europe/Zurich", "Europe/Belfast", "Europe/Bucharest", "Europe/Gibraltar", "Europe/Jersey", "Europe/London", "Europe/Minsk", "Europe/Paris", "Europe/Samara", "Europe/Sofia", "Europe/Uzhgorod", "Europe/Volgograd", "Europe/Belgrade", "Europe/Budapest", "Europe/Guernsey", "Europe/Kaliningrad", "Europe/Luxembourg", "Europe/Monaco", "Europe/Podgorica", "Europe/San_Marino", "Europe/Stockholm", "Europe/Vaduz", "Europe/Warsaw", "Indian/Cocos", "Indian/Mauritius", "Indian/Christmas", "Indian/Maldives", "Indian/Comoro", "Indian/Mayotte", "Australia/Brisbane", "Australia/Eucla", "Australia/Melbourne", "Australia/South", "Australia/Yancowinna", ); 

Timezones in PHP at http://www.php.net/manual/en/timezones.php

Answer:

List of entire available timezones.

$time_zones = array ( 0 => 'Africa/Abidjan', 1 => 'Africa/Accra', 2 => 'Africa/Addis_Ababa', 3 => 'Africa/Algiers', 4 => 'Africa/Asmara', 5 => 'Africa/Asmera', 6 => 'Africa/Bamako', 7 => 'Africa/Bangui', 8 => 'Africa/Banjul', 9 => 'Africa/Bissau', 10 => 'Africa/Blantyre', 11 => 'Africa/Brazzaville', 12 => 'Africa/Bujumbura', 13 => 'Africa/Cairo', 14 => 'Africa/Casablanca', 15 => 'Africa/Ceuta', 16 => 'Africa/Conakry', 17 => 'Africa/Dakar', 18 => 'Africa/Dar_es_Salaam', 19 => 'Africa/Djibouti', 20 => 'Africa/Douala', 21 => 'Africa/El_Aaiun', 22 => 'Africa/Freetown', 23 => 'Africa/Gaborone', 24 => 'Africa/Harare', 25 => 'Africa/Johannesburg', 26 => 'Africa/Juba', 27 => 'Africa/Kampala', 28 => 'Africa/Khartoum', 29 => 'Africa/Kigali', 30 => 'Africa/Kinshasa', 31 => 'Africa/Lagos', 32 => 'Africa/Libreville', 33 => 'Africa/Lome', 34 => 'Africa/Luanda', 35 => 'Africa/Lubumbashi', 36 => 'Africa/Lusaka', 37 => 'Africa/Malabo', 38 => 'Africa/Maputo', 39 => 'Africa/Maseru', 40 => 'Africa/Mbabane', 41 => 'Africa/Mogadishu', 42 => 'Africa/Monrovia', 43 => 'Africa/Nairobi', 44 => 'Africa/Ndjamena', 45 => 'Africa/Niamey', 46 => 'Africa/Nouakchott', 47 => 'Africa/Ouagadougou', 48 => 'Africa/Porto-Novo', 49 => 'Africa/Sao_Tome', 50 => 'Africa/Timbuktu', 51 => 'Africa/Tripoli', 52 => 'Africa/Tunis', 53 => 'Africa/Windhoek', 54 => 'America/Adak', 55 => 'America/Anchorage', 56 => 'America/Anguilla', 57 => 'America/Antigua', 58 => 'America/Araguaina', 59 => 'America/Argentina/Buenos_Aires', 60 => 'America/Argentina/Catamarca', 61 => 'America/Argentina/ComodRivadavia', 62 => 'America/Argentina/Cordoba', 63 => 'America/Argentina/Jujuy', 64 => 'America/Argentina/La_Rioja', 65 => 'America/Argentina/Mendoza', 66 => 'America/Argentina/Rio_Gallegos', 67 => 'America/Argentina/Salta', 68 => 'America/Argentina/San_Juan', 69 => 'America/Argentina/San_Luis', 70 => 'America/Argentina/Tucuman', 71 => 'America/Argentina/Ushuaia', 72 => 'America/Aruba', 73 => 'America/Asuncion', 74 => 'America/Atikokan', 75 => 'America/Atka', 76 => 'America/Bahia', 77 => 'America/Bahia_Banderas', 78 => 'America/Barbados', 79 => 'America/Belem', 80 => 'America/Belize', 81 => 'America/Blanc-Sablon', 82 => 'America/Boa_Vista', 83 => 'America/Bogota', 84 => 'America/Boise', 85 => 'America/Buenos_Aires', 86 => 'America/Cambridge_Bay', 87 => 'America/Campo_Grande', 88 => 'America/Cancun', 89 => 'America/Caracas', 90 => 'America/Catamarca', 91 => 'America/Cayenne', 92 => 'America/Cayman', 93 => 'America/Chicago', 94 => 'America/Chihuahua', 95 => 'America/Coral_Harbour', 96 => 'America/Cordoba', 97 => 'America/Costa_Rica', 98 => 'America/Creston', 99 => 'America/Cuiaba', 100 => 'America/Curacao', 101 => 'America/Danmarkshavn', 102 => 'America/Dawson', 103 => 'America/Dawson_Creek', 104 => 'America/Denver', 105 => 'America/Detroit', 106 => 'America/Dominica', 107 => 'America/Edmonton', 108 => 'America/Eirunepe', 109 => 'America/El_Salvador', 110 => 'America/Ensenada', 111 => 'America/Fort_Nelson', 112 => 'America/Fort_Wayne', 113 => 'America/Fortaleza', 114 => 'America/Glace_Bay', 115 => 'America/Godthab', 116 => 'America/Goose_Bay', 117 => 'America/Grand_Turk', 118 => 'America/Grenada', 119 => 'America/Guadeloupe', 120 => 'America/Guatemala', 121 => 'America/Guayaquil', 122 => 'America/Guyana', 123 => 'America/Halifax', 124 => 'America/Havana', 125 => 'America/Hermosillo', 126 => 'America/Indiana/Indianapolis', 127 => 'America/Indiana/Knox', 128 => 'America/Indiana/Marengo', 129 => 'America/Indiana/Petersburg', 130 => 'America/Indiana/Tell_City', 131 => 'America/Indiana/Vevay', 132 => 'America/Indiana/Vincennes', 133 => 'America/Indiana/Winamac', 134 => 'America/Indianapolis', 135 => 'America/Inuvik', 136 => 'America/Iqaluit', 137 => 'America/Jamaica', 138 => 'America/Jujuy', 139 => 'America/Juneau', 140 => 'America/Kentucky/Louisville', 141 => 'America/Kentucky/Monticello', 142 => 'America/Knox_IN', 143 => 'America/Kralendijk', 144 => 'America/La_Paz', 145 => 'America/Lima', 146 => 'America/Los_Angeles', 147 => 'America/Louisville', 148 => 'America/Lower_Princes', 149 => 'America/Maceio', 150 => 'America/Managua', 151 => 'America/Manaus', 152 => 'America/Marigot', 153 => 'America/Martinique', 154 => 'America/Matamoros', 155 => 'America/Mazatlan', 156 => 'America/Mendoza', 157 => 'America/Menominee', 158 => 'America/Merida', 159 => 'America/Metlakatla', 160 => 'America/Mexico_City', 161 => 'America/Miquelon', 162 => 'America/Moncton', 163 => 'America/Monterrey', 164 => 'America/Montevideo', 165 => 'America/Montreal', 166 => 'America/Montserrat', 167 => 'America/Nassau', 168 => 'America/New_York', 169 => 'America/Nipigon', 170 => 'America/Nome', 171 => 'America/Noronha', 172 => 'America/North_Dakota/Beulah', 173 => 'America/North_Dakota/Center', 174 => 'America/North_Dakota/New_Salem', 175 => 'America/Ojinaga', 176 => 'America/Panama', 177 => 'America/Pangnirtung', 178 => 'America/Paramaribo', 179 => 'America/Phoenix', 180 => 'America/Port-au-Prince', 181 => 'America/Port_of_Spain', 182 => 'America/Porto_Acre', 183 => 'America/Porto_Velho', 184 => 'America/Puerto_Rico', 185 => 'America/Rainy_River', 186 => 'America/Rankin_Inlet', 187 => 'America/Recife', 188 => 'America/Regina', 189 => 'America/Resolute', 190 => 'America/Rio_Branco', 191 => 'America/Rosario', 192 => 'America/Santa_Isabel', 193 => 'America/Santarem', 194 => 'America/Santiago', 195 => 'America/Santo_Domingo', 196 => 'America/Sao_Paulo', 197 => 'America/Scoresbysund', 198 => 'America/Shiprock', 199 => 'America/Sitka', 200 => 'America/St_Barthelemy', 201 => 'America/St_Johns', 202 => 'America/St_Kitts', 203 => 'America/St_Lucia', 204 => 'America/St_Thomas', 205 => 'America/St_Vincent', 206 => 'America/Swift_Current', 207 => 'America/Tegucigalpa', 208 => 'America/Thule', 209 => 'America/Thunder_Bay', 210 => 'America/Tijuana', 211 => 'America/Toronto', 212 => 'America/Tortola', 213 => 'America/Vancouver', 214 => 'America/Virgin', 215 => 'America/Whitehorse', 216 => 'America/Winnipeg', 217 => 'America/Yakutat', 218 => 'America/Yellowknife', 219 => 'Antarctica/Casey', 220 => 'Antarctica/Davis', 221 => 'Antarctica/DumontDUrville', 222 => 'Antarctica/Macquarie', 223 => 'Antarctica/Mawson', 224 => 'Antarctica/McMurdo', 225 => 'Antarctica/Palmer', 226 => 'Antarctica/Rothera', 227 => 'Antarctica/South_Pole', 228 => 'Antarctica/Syowa', 229 => 'Antarctica/Troll', 230 => 'Antarctica/Vostok', 231 => 'Arctic/Longyearbyen', 232 => 'Asia/Aden', 233 => 'Asia/Almaty', 234 => 'Asia/Amman', 235 => 'Asia/Anadyr', 236 => 'Asia/Aqtau', 237 => 'Asia/Aqtobe', 238 => 'Asia/Ashgabat', 239 => 'Asia/Ashkhabad', 240 => 'Asia/Baghdad', 241 => 'Asia/Bahrain', 242 => 'Asia/Baku', 243 => 'Asia/Bangkok', 244 => 'Asia/Beirut', 245 => 'Asia/Bishkek', 246 => 'Asia/Brunei', 247 => 'Asia/Calcutta', 248 => 'Asia/Chita', 249 => 'Asia/Choibalsan', 250 => 'Asia/Chongqing', 251 => 'Asia/Chungking', 252 => 'Asia/Colombo', 253 => 'Asia/Dacca', 254 => 'Asia/Damascus', 255 => 'Asia/Dhaka', 256 => 'Asia/Dili', 257 => 'Asia/Dubai', 258 => 'Asia/Dushanbe', 259 => 'Asia/Gaza', 260 => 'Asia/Harbin', 261 => 'Asia/Hebron', 262 => 'Asia/Ho_Chi_Minh', 263 => 'Asia/Hong_Kong', 264 => 'Asia/Hovd', 265 => 'Asia/Irkutsk', 266 => 'Asia/Istanbul', 267 => 'Asia/Jakarta', 268 => 'Asia/Jayapura', 269 => 'Asia/Jerusalem', 270 => 'Asia/Kabul', 271 => 'Asia/Kamchatka', 272 => 'Asia/Karachi', 273 => 'Asia/Kashgar', 274 => 'Asia/Kathmandu', 275 => 'Asia/Katmandu', 276 => 'Asia/Khandyga', 277 => 'Asia/Kolkata', 278 => 'Asia/Krasnoyarsk', 279 => 'Asia/Kuala_Lumpur', 280 => 'Asia/Kuching', 281 => 'Asia/Kuwait', 282 => 'Asia/Macao', 283 => 'Asia/Macau', 284 => 'Asia/Magadan', 285 => 'Asia/Makassar', 286 => 'Asia/Manila', 287 => 'Asia/Muscat', 288 => 'Asia/Nicosia', 289 => 'Asia/Novokuznetsk', 290 => 'Asia/Novosibirsk', 291 => 'Asia/Omsk', 292 => 'Asia/Oral', 293 => 'Asia/Phnom_Penh', 294 => 'Asia/Pontianak', 295 => 'Asia/Pyongyang', 296 => 'Asia/Qatar', 297 => 'Asia/Qyzylorda', 298 => 'Asia/Rangoon', 299 => 'Asia/Riyadh', 300 => 'Asia/Saigon', 301 => 'Asia/Sakhalin', 302 => 'Asia/Samarkand', 303 => 'Asia/Seoul', 304 => 'Asia/Shanghai', 305 => 'Asia/Singapore', 306 => 'Asia/Srednekolymsk', 307 => 'Asia/Taipei', 308 => 'Asia/Tashkent', 309 => 'Asia/Tbilisi', 310 => 'Asia/Tehran', 311 => 'Asia/Tel_Aviv', 312 => 'Asia/Thimbu', 313 => 'Asia/Thimphu', 314 => 'Asia/Tokyo', 315 => 'Asia/Ujung_Pandang', 316 => 'Asia/Ulaanbaatar', 317 => 'Asia/Ulan_Bator', 318 => 'Asia/Urumqi', 319 => 'Asia/Ust-Nera', 320 => 'Asia/Vientiane', 321 => 'Asia/Vladivostok', 322 => 'Asia/Yakutsk', 323 => 'Asia/Yekaterinburg', 324 => 'Asia/Yerevan', 325 => 'Atlantic/Azores', 326 => 'Atlantic/Bermuda', 327 => 'Atlantic/Canary', 328 => 'Atlantic/Cape_Verde', 329 => 'Atlantic/Faeroe', 330 => 'Atlantic/Faroe', 331 => 'Atlantic/Jan_Mayen', 332 => 'Atlantic/Madeira', 333 => 'Atlantic/Reykjavik', 334 => 'Atlantic/South_Georgia', 335 => 'Atlantic/St_Helena', 336 => 'Atlantic/Stanley', 337 => 'Australia/ACT', 338 => 'Australia/Adelaide', 339 => 'Australia/Brisbane', 340 => 'Australia/Broken_Hill', 341 => 'Australia/Canberra', 342 => 'Australia/Currie', 343 => 'Australia/Darwin', 344 => 'Australia/Eucla', 345 => 'Australia/Hobart', 346 => 'Australia/LHI', 347 => 'Australia/Lindeman', 348 => 'Australia/Lord_Howe', 349 => 'Australia/Melbourne', 350 => 'Australia/North', 351 => 'Australia/NSW', 352 => 'Australia/Perth', 353 => 'Australia/Queensland', 354 => 'Australia/South', 355 => 'Australia/Sydney', 356 => 'Australia/Tasmania', 357 => 'Australia/Victoria', 358 => 'Australia/West', 359 => 'Australia/Yancowinna', 360 => 'Europe/Amsterdam', 361 => 'Europe/Andorra', 362 => 'Europe/Athens', 363 => 'Europe/Belfast', 364 => 'Europe/Belgrade', 365 => 'Europe/Berlin', 366 => 'Europe/Bratislava', 367 => 'Europe/Brussels', 368 => 'Europe/Bucharest', 369 => 'Europe/Budapest', 370 => 'Europe/Busingen', 371 => 'Europe/Chisinau', 372 => 'Europe/Copenhagen', 373 => 'Europe/Dublin', 374 => 'Europe/Gibraltar', 375 => 'Europe/Guernsey', 376 => 'Europe/Helsinki', 377 => 'Europe/Isle_of_Man', 378 => 'Europe/Istanbul', 379 => 'Europe/Jersey', 380 => 'Europe/Kaliningrad', 381 => 'Europe/Kiev', 382 => 'Europe/Lisbon', 383 => 'Europe/Ljubljana', 384 => 'Europe/London', 385 => 'Europe/Luxembourg', 386 => 'Europe/Madrid', 387 => 'Europe/Malta', 388 => 'Europe/Mariehamn', 389 => 'Europe/Minsk', 390 => 'Europe/Monaco', 391 => 'Europe/Moscow', 392 => 'Europe/Nicosia', 393 => 'Europe/Oslo', 394 => 'Europe/Paris', 395 => 'Europe/Podgorica', 396 => 'Europe/Prague', 397 => 'Europe/Riga', 398 => 'Europe/Rome', 399 => 'Europe/Samara', 400 => 'Europe/San_Marino', 401 => 'Europe/Sarajevo', 402 => 'Europe/Simferopol', 403 => 'Europe/Skopje', 404 => 'Europe/Sofia', 405 => 'Europe/Stockholm', 406 => 'Europe/Tallinn', 407 => 'Europe/Tirane', 408 => 'Europe/Tiraspol', 409 => 'Europe/Uzhgorod', 410 => 'Europe/Vaduz', 411 => 'Europe/Vatican', 412 => 'Europe/Vienna', 413 => 'Europe/Vilnius', 414 => 'Europe/Volgograd', 415 => 'Europe/Warsaw', 416 => 'Europe/Zagreb', 417 => 'Europe/Zaporozhye', 418 => 'Europe/Zurich', 419 => 'Indian/Antananarivo', 420 => 'Indian/Chagos', 421 => 'Indian/Christmas', 422 => 'Indian/Cocos', 423 => 'Indian/Comoro', 424 => 'Indian/Kerguelen', 425 => 'Indian/Mahe', 426 => 'Indian/Maldives', 427 => 'Indian/Mauritius', 428 => 'Indian/Mayotte', 429 => 'Indian/Reunion', 430 => 'Pacific/Apia', 431 => 'Pacific/Auckland', 432 => 'Pacific/Bougainville', 433 => 'Pacific/Chatham', 434 => 'Pacific/Chuuk', 435 => 'Pacific/Easter', 436 => 'Pacific/Efate', 437 => 'Pacific/Enderbury', 438 => 'Pacific/Fakaofo', 439 => 'Pacific/Fiji', 440 => 'Pacific/Funafuti', 441 => 'Pacific/Galapagos', 442 => 'Pacific/Gambier', 443 => 'Pacific/Guadalcanal', 444 => 'Pacific/Guam', 445 => 'Pacific/Honolulu', 446 => 'Pacific/Johnston', 447 => 'Pacific/Kiritimati', 448 => 'Pacific/Kosrae', 449 => 'Pacific/Kwajalein', 450 => 'Pacific/Majuro', 451 => 'Pacific/Marquesas', 452 => 'Pacific/Midway', 453 => 'Pacific/Nauru', 454 => 'Pacific/Niue', 455 => 'Pacific/Norfolk', 456 => 'Pacific/Noumea', 457 => 'Pacific/Pago_Pago', 458 => 'Pacific/Palau', 459 => 'Pacific/Pitcairn', 460 => 'Pacific/Pohnpei', 461 => 'Pacific/Ponape', 462 => 'Pacific/Port_Moresby', 463 => 'Pacific/Rarotonga', 464 => 'Pacific/Saipan', 465 => 'Pacific/Samoa', 466 => 'Pacific/Tahiti', 467 => 'Pacific/Tarawa', 468 => 'Pacific/Tongatapu', 469 => 'Pacific/Truk', 470 => 'Pacific/Wake', 471 => 'Pacific/Wallis', 472 => 'Pacific/Yap', 473 => 'Brazil/Acre', 474 => 'Brazil/DeNoronha', 475 => 'Brazil/East', 476 => 'Brazil/West', 477 => 'Canada/Atlantic', 478 => 'Canada/Central', 479 => 'Canada/East-Saskatchewan', 480 => 'Canada/Eastern', 481 => 'Canada/Mountain', 482 => 'Canada/Newfoundland', 483 => 'Canada/Pacific', 484 => 'Canada/Saskatchewan', 485 => 'Canada/Yukon', 486 => 'CET', 487 => 'Chile/Continental', 488 => 'Chile/EasterIsland', 489 => 'CST6CDT', 490 => 'Cuba', 491 => 'EET', 492 => 'Egypt', 493 => 'Eire', 494 => 'EST', 495 => 'EST5EDT', 496 => 'Etc/GMT', 497 => 'Etc/GMT+0', 498 => 'Etc/GMT+1', 499 => 'Etc/GMT+10', 500 => 'Etc/GMT+11', 501 => 'Etc/GMT+12', 502 => 'Etc/GMT+2', 503 => 'Etc/GMT+3', 504 => 'Etc/GMT+4', 505 => 'Etc/GMT+5', 506 => 'Etc/GMT+6', 507 => 'Etc/GMT+7', 508 => 'Etc/GMT+8', 509 => 'Etc/GMT+9', 510 => 'Etc/GMT-0', 511 => 'Etc/GMT-1', 512 => 'Etc/GMT-10', 513 => 'Etc/GMT-11', 514 => 'Etc/GMT-12', 515 => 'Etc/GMT-13', 516 => 'Etc/GMT-14', 517 => 'Etc/GMT-2', 518 => 'Etc/GMT-3', 519 => 'Etc/GMT-4', 520 => 'Etc/GMT-5', 521 => 'Etc/GMT-6', 522 => 'Etc/GMT-7', 523 => 'Etc/GMT-8', 524 => 'Etc/GMT-9', 525 => 'Etc/GMT0', 526 => 'Etc/Greenwich', 527 => 'Etc/UCT', 528 => 'Etc/Universal', 529 => 'Etc/UTC', 530 => 'Etc/Zulu', 531 => 'Factory', 532 => 'GB', 533 => 'GB-Eire', 534 => 'GMT', 535 => 'GMT+0', 536 => 'GMT-0', 537 => 'GMT0', 538 => 'Greenwich', 539 => 'Hongkong', 540 => 'HST', 541 => 'Iceland', 542 => 'Iran', 543 => 'Israel', 544 => 'Jamaica', 545 => 'Japan', 546 => 'Kwajalein', 547 => 'Libya', 548 => 'MET', 549 => 'Mexico/BajaNorte', 550 => 'Mexico/BajaSur', 551 => 'Mexico/General', 552 => 'MST', 553 => 'MST7MDT', 554 => 'Navajo', 555 => 'NZ', 556 => 'NZ-CHAT', 557 => 'Poland', 558 => 'Portugal', 559 => 'PRC', 560 => 'PST8PDT', 561 => 'ROC', 562 => 'ROK', 563 => 'Singapore', 564 => 'Turkey', 565 => 'UCT', 566 => 'Universal', 567 => 'US/Alaska', 568 => 'US/Aleutian', 569 => 'US/Arizona', 570 => 'US/Central', 571 => 'US/East-Indiana', 572 => 'US/Eastern', 573 => 'US/Hawaii', 574 => 'US/Indiana-Starke', 575 => 'US/Michigan', 576 => 'US/Mountain', 577 => 'US/Pacific', 578 => 'US/Pacific-New', 579 => 'US/Samoa', 580 => 'UTC', 581 => 'W-SU', 582 => 'WET', 583 => 'Zulu', ) 

Answer:

Is ‘UTC’ a valid timezone identifier on your system?

<?php if (date_default_timezone_set('UTC')){ echo "UTC is a valid time zone"; }else{ echo "The system doesn't know WTFUTC. Maybe try updating tzinfo with your package manager?"; } 

Answer:

You can always check this maintained list to timezones

https://www.php.net/manual/en/function.date.php

Answer:

In PHP DateTime (PHP >= 5.3)

$dt = new DateTime(); $dt->setTimezone(new DateTimeZone('UTC')); echo $dt->getTimestamp();