php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63429 Incomplete Timezone Transitions
Submitted: 2012-11-03 16:16 UTC Modified: 2015-07-18 16:38 UTC
Votes:3
Avg. Score:2.7 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: alix dot axel+php at gmail dot com Assigned: cmb (profile)
Status: Closed Package: timezonedb (PECL)
PHP Version: 5.4.8 OS: Ubuntu 12.04.1 LTS
Private report: No CVE-ID: None
 [2012-11-03 16:16 UTC] alix dot axel+php at gmail dot com
Description:
------------
I'm running "Olson" Timezone Database Version 2012.8.

Certain timezone transitions seem to be outdated or buggy (wrong abbreviations 
and wrong offsets/dst combinations),

For America/Argentina/San_Luis see 
http://www.timeanddate.com/worldclock/city.html?n=613 and 
http://en.wikipedia.org/wiki/America/Argentina/San_Luis.

I just wanted to get the standard offset 
(http://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for each timezone 
in order to automatically populate a drop drown select box.

For more details / tests see: http://stackoverflow.com/q/13203759/89771.

Test script:
---------------
<?php

function getStandardOffsetFromUTC($timezone)
{
    $timezone = new DateTimeZone($timezone);
    $transitions = array_slice($timezone->getTransitions(), -3);

    foreach (array_reverse($transitions) as $transition)
    {
        if ($transition['isdst'] == 1) // we are interested in standard offsets only
        {
            continue;
        }

        return sprintf('UTC %+03d:%02u', $transition['offset'] / 3600, abs($transition['offset']) % 3600 / 60);
    }

    return false;
}

echo getStandardOffsetFromUTC('America/Argentina/San_Luis') . "\n";
echo getStandardOffsetFromUTC('Antarctica/Casey') . "\n";
echo getStandardOffsetFromUTC('Antarctica/Davis') . "\n";

Expected result:
----------------
UTC -03:00
UTC +11:00
UTC +05:00

Actual result:
--------------
UTC -04:00
UTC +08:00
UTC +07:00

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-03 16:18 UTC] alix dot axel+php at gmail dot com
Forgot to say that for San_Luis the latest timezone abbreviation should be ART 
and not WAR[S]T.
 [2015-07-18 16:38 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2015-07-18 16:38 UTC] cmb@php.net
The offset has been wrong for America/Argentina/San_Luis, what
has been fixed as of PHP 5.4.21/timezonedb 2013.6[1].

The offsets of Antarctica/Casey and Antarctica/Davis might be wrong,
but that would have to be fixed upstream in IANAs time zone db[2].

[1] <http://3v4l.org/ZHfTQ>
[2] <http://www.iana.org/time-zones>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC