php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63569 DateTimeZone::listAbbreviations() reports inccorrect offset
Submitted: 2012-11-21 00:31 UTC Modified: 2012-11-21 16:13 UTC
From: zippidyzap at gmail dot com Assigned:
Status: Closed Package: Date/time related
PHP Version: 5.3.18 OS: CentOS 6.3
Private report: No CVE-ID: None
 [2012-11-21 00:31 UTC] zippidyzap at gmail dot com
Description:
------------
DateTimeZone::listAbbreviations() reports incorrect. When executed on (server time) 2012-11-20T00:00:00-08:00, reported that offset for America/Los_Angeles as -25200.

DateTimeZone::getTransitionOffsets reports the offset correctly as -28800.

Test script:
---------------
<?php
$var = DateTimeZone::listAbbreviations();
print_r($var['pdt'][0]);
		
$timezone = new DateTimeZone("America/Los_Angeles");
print_r($timezone->getTransitions(time(), time()));
?>

Expected result:
----------------
Array
(
    [dst] => 0
    [offset] => -28800
    [timezone_id] => America/Los_Angeles
)
Array
(
    [0] => Array
        (
            [ts] => 1353457792
            [time] => 2012-11-21T00:29:52+0000
            [offset] => -28800
            [isdst] => 
            [abbr] => PST
        )

)

Actual result:
--------------
Array
(
    [dst] => 1
    [offset] => -25200
    [timezone_id] => America/Los_Angeles
)
Array
(
    [0] => Array
        (
            [ts] => 1353457792
            [time] => 2012-11-21T00:29:52+0000
            [offset] => -28800
            [isdst] => 
            [abbr] => PST
        )

)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-21 16:13 UTC] zippidyzap at gmail dot com
-Status: Open +Status: Closed
 [2012-11-21 16:13 UTC] zippidyzap at gmail dot com
DateTimeZone::listAbbreviations() reports *all* timezones available, not all *current* timezones.

Maybe the documentation could use some improvement, but this isn't a bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 08:01:27 2024 UTC