php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70816 timezone_identifiers_list() missing some timezones
Submitted: 2015-10-29 20:01 UTC Modified: 2016-04-18 16:04 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: asphp at dsgml dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2015-10-29 20:01 UTC] asphp at dsgml dot com
Description:
------------
The timezone_identifiers_list() does not list aliases, even though they are listed on http://php.net/manual/en/timezones.php and they work if you try to create a date with them.

It should include all timezones, even aliases.

Test script:
---------------
<?
new DateTimeZone("Asia/Tel_Aviv"); //works fine
new DateTimeZone("America/Porto_Acre"); //works fine
new DateTimeZone("America/Montreal"); //works fine

var_dump(in_array("Asia/Tel_Aviv", timezone_identifiers_list())); //false
var_dump(in_array("America/Porto_Acre", timezone_identifiers_list())); //false
var_dump(in_array("America/Montreal", timezone_identifiers_list())); //false

//Those are alias to these:
var_dump(in_array("Asia/Jerusalem", timezone_identifiers_list())); //true
var_dump(in_array("America/Rio_Branco", timezone_identifiers_list())); //true
var_dump(in_array("America/Toronto", timezone_identifiers_list())); //true




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-10-29 20:28 UTC] asphp at dsgml dot com
List of missing timezones:

Africa/Asmera
Africa/Timbuktu
America/Argentina/ComodRivadavia
America/Atka
America/Buenos_Aires
America/Catamarca
America/Coral_Harbour
America/Cordoba
America/Ensenada
America/Fort_Wayne
America/Indianapolis
America/Jujuy
America/Knox_IN
America/Louisville
America/Mendoza
America/Montreal
America/Port-au-Prince
America/Porto_Acre
America/Rosario
America/Shiprock
America/Virgin
Antarctica/South_Pole
Asia/Ashkhabad
Asia/Calcutta
Asia/Chongqing
Asia/Chungking
Asia/Dacca
Asia/Harbin
Asia/Istanbul
Asia/Kashgar
Asia/Katmandu
Asia/Macao
Asia/Saigon
Asia/Tel_Aviv
Asia/Thimbu
Asia/Ujung_Pandang
Asia/Ulan_Bator
Atlantic/Faeroe
Atlantic/Jan_Mayen
Australia/ACT
Australia/Canberra
Australia/LHI
Australia/North
Australia/NSW
Australia/Queensland
Australia/South
Australia/Tasmania
Australia/Victoria
Australia/West
Australia/Yancowinna
Brazil/Acre
Brazil/DeNoronha
Brazil/East
Brazil/West
Canada/Atlantic
Canada/Central
Canada/Eastern
Canada/East-Saskatchewan
Canada/Mountain
Canada/Newfoundland
Canada/Pacific
Canada/Saskatchewan
Canada/Yukon
CET
Chile/Continental
Chile/EasterIsland
CST6CDT
Cuba
EET
Egypt
Eire
EST
EST5EDT
Etc/GMT
Etc/GMT+0
Etc/GMT+1
Etc/GMT+10
Etc/GMT+11
Etc/GMT+12
Etc/GMT+2
Etc/GMT+3
Etc/GMT+4
Etc/GMT+5
Etc/GMT+6
Etc/GMT+7
Etc/GMT+8
Etc/GMT+9
Etc/GMT0
Etc/GMT-0
Etc/GMT-1
Etc/GMT-10
Etc/GMT-11
Etc/GMT-12
Etc/GMT-13
Etc/GMT-14
Etc/GMT-2
Etc/GMT-3
Etc/GMT-4
Etc/GMT-5
Etc/GMT-6
Etc/GMT-7
Etc/GMT-8
Etc/GMT-9
Etc/Greenwich
Etc/UCT
Etc/Universal
Etc/UTC
Etc/Zulu
Europe/Belfast
Europe/Nicosia
Europe/Tiraspol
GB
GB-Eire
GMT
GMT+0
GMT0
GMT-0
Greenwich
Hongkong
HST
Iceland
Iran
Israel
Jamaica
Japan
Kwajalein
Libya
MET
Mexico/BajaNorte
Mexico/BajaSur
Mexico/General
MST
MST7MDT
Navajo
NZ
NZ-CHAT
Pacific/Ponape
Pacific/Samoa
Pacific/Truk
Pacific/Yap
Poland
Portugal
PRC
PST8PDT
ROC
ROK
Singapore
Turkey
UCT
Universal
US/Alaska
US/Aleutian
US/Arizona
US/Central
US/Eastern
US/East-Indiana
US/Hawaii
US/Indiana-Starke
US/Michigan
US/Mountain
US/Pacific
US/Pacific-New
US/Samoa
WET
W-SU
Zulu
 [2016-04-18 16:03 UTC] derick@php.net
This is not a bug, these zones are available, but because they are deprecated, they do not *by default* show up in timezone_identifiers_list(). If you want them to show up, you need to specify the DateTimeZone::ALL_WITH_BC constant as first argument to that function to get the deprecated zones included as well.
 [2016-04-18 16:04 UTC] derick@php.net
-Status: Open +Status: Not a bug
 [2016-04-18 16:04 UTC] derick@php.net
.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 22 09:01:29 2024 UTC