Bug #51975 [Opn->Bgs]: Missing DST free (UTC±X) timezones in DateTimeZone::listIdentifiers()
| From: | aharvey@php.net | Date: | Wed, 02 Jun 2010 13:41:15 +0000 |
| Subject: | Bug #51975 [Opn->Bgs]: Missing DST free (UTC±X) timezones in DateTimeZone::listIdentifiers() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-151019@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51975&edit=1
ID: 51975
Updated by: aharvey@php.net
Reported by: V-o-E at gmx dot de
Summary: Missing DST free (UTC±X) timezones in
DateTimeZone::listIdentifiers()
-Status: Open
+Status: Bogus
Type: Bug
Package: Date/time related
Operating System: All
PHP Version: 5.3.2
New Comment:
The Olson tz database -- which forms the basis of the time zone support
both for PHP and pretty much every operating system not called Windows
-- doesn't define any time zones relative to UTC other than the
Etc/GMT±x time zones and the UTC time zone itself.
The Etc/GMT time zones are the "wrong way around", but that's been the
case for decades, and isn't something we (or probably anyone else) can
fix without confusing people even more.
Previous Comments:
------------------------------------------------------------------------
[2010-06-02 15:27:44] V-o-E at gmx dot de
Description:
------------
There are not daylight saving time free timezones (UTC±X) in
DateTimeZone::listIdentifiers() (same with DateTimeZone::ALL) except
UTC±0.
As workaround i can use buggy "Etc/GMT±X" from
DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC):
Etc/GMT+2 => Etc/GMT-2
Etc/GMT-2 => Etc/GMT+2
See: http://en.wikipedia.org/wiki/List_of_time_zones_by_UTC_offset
Test script:
---------------
var_dump(DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC));
var_dump(DateTimeZone::listIdentifiers());
$a = DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC);
var_dump($a[373]); // output: string(9) "Etc/GMT+2"
$b = DateTimeZone::listIdentifiers();
var_dump($b[373]); // output: string(15) "Pacific/Fakaofo"
date_default_timezone_set('UTC');
echo date('H:i:s') . "\n"; // output: 13:13:01
date_default_timezone_set('Etc/GMT+2');
echo date('H:i:s') . "\n"; // output: 11:13:01
date_default_timezone_set('Etc/GMT-2');
echo date('H:i:s') . "\n"; // output: 15:13:01
date_default_timezone_set('Pacific/Fakaofo');
echo date('H:i:s') . "\n"; // output: 01:13:01
Expected result:
----------------
array(564) {
...
}
array(xyz) {
...
[405]=>
string(3) "UTC"
[406]=>
string(3) "UTC-12"
[407]=>
string(3) "UTC-11"
...
}
string(9) "Pacific/Fakaofo"
string(15) "Pacific/Fakaofo"
13:16:08
15:16:08
11:16:08
03:16:08
Actual result:
--------------
array(564) {
...
}
array(406) {
...
[405]=>
string(3) "UTC"
}
string(9) "Etc/GMT+2"
string(15) "Pacific/Fakaofo"
13:16:08
11:16:08
15:16:08
03:16:08
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51975&edit=1