|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #70801 More concise and clearly labeled time zones
Submitted: 2015-10-27 15:20 UTC Modified: 2017-04-24 12:07 UTC
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: scott at connerly dot net Assigned:
Status: Wont fix Package: Date/time related
PHP Version: Irrelevant OS: n/a
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-10-27 15:20 UTC] scott at connerly dot net
Currently, DateTimeZone::listIdentifiers() returns all 417 Zones and Links that were ever available in the tz database. Additionally, the only names supplied by DateTimeZone::getLocation() are the actual time zone names, not any user-friendly names.

This request to PHP is the companion request to this request to Ruby:
which references this array:

My requests:
 - Add a mechanism to get just the primary identifiers, perhaps by a new constant similar to ALL_WITH_BC, like PRIMARY_ACTIVE. This would return the curated list of 149 rather than all 417.
 - Add a mechanism to get the user-friendly name for an identifier. Perhaps this could happen by adding an array element in DateTimeZone::getLocation()s' results.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-10-28 01:26 UTC] scott at connerly dot net
In the case that there is more than one relevant user-friendly name for a time zone identifier, an array of user-friendly names may be required. Example: Asia/Tokyo could have the friendly names of Osaka, Sapporo, or Tokyo.
 [2015-10-31 02:40 UTC] scott at connerly dot net
FYI, here's the repo I created to utilize Ruby's timezone list in PHP.
Its far from elegant, but it gets the job done. Its never great to scrape content, but for now, it'll do.
 [2017-04-24 12:07 UTC]
-Status: Open +Status: Wont fix
 [2017-04-24 12:07 UTC]
The list you are showing in the screenshot does NOT contain Timezones (at least in the top) but Timezone-Abbreviations. These should NOT be used to assign timezones.

A better approach would  be to select a city and then use geolocation tools available to determine the correct timezone for that area.

In any case that's not something I'd see within the PHP-Core but within a userland library.
 [2019-06-17 17:33 UTC] webmaster at schoenstatt dot link
I really think this is a necessary problem to fix. PHP does not currently provide a full solution for working with time zones because of the sheer quantity and the inability to distinguish between current and outdated ones. Please look at Scott's solution, as it really helped me as a work around. It would be great to get this integrated into the language!
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Jan 31 18:03:43 2023 UTC