Bug #76530 [Com]: Timezone is incorrectly applied when converting dates beyond 2037
| From: | a at b dot c dot de | Date: | Tue, 26 Jun 2018 04:28:41 +0000 |
| Subject: | Bug #76530 [Com]: Timezone is incorrectly applied when converting dates beyond 2037 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-215976@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76530&edit=1
ID: 76530
Comment by: a at b dot c dot de
Reported by: mlambley at gmail dot com
Summary: Timezone is incorrectly applied when converting
dates beyond 2037
Status: Duplicate
Type: Bug
Package: Scripting Engine problem
Operating System: Windows 10, FreeBSD, others
PHP Version: 7.2.7
Block user comment: N
Private report: N
New Comment:
Doesn't Australian Central Daylight Saving start on October 4 in 2037? Given, that, the shown
behaviour is expected.
It would end on 5th April, so I predict that the times would be 10:30 and 9:30 for the 5th and 6th
of April 2038, respectively:
$date1 = new DateTime('2038-04-05');
var_dump($date1->format('c: I'));
$date2 = new DateTime('2038-04-06');
var_dump($date2->format('c: I'));
...Still thinks its Daylight Saving. In fact, it claims the whole year is in DST.
for($m = 1; $m <= 12; ++$m) {
for($d = 1; $d <= 31; ++$d){
if(checkdate($m, $d, 2038)) {
echo (new DateTime("2038-$m-$d"))->format("c: I\n");
}
}
}
See also:
$zone = new DateTimeZone('Australia/Adelaide');
$transitions = $zone->getTransitions();
var_dump(array_pop($transitions));
Previous Comments:
------------------------------------------------------------------------
[2018-06-26 04:03:33] requinix@php.net
Duplicate of bug #64992
------------------------------------------------------------------------
[2018-06-26 03:52:12] mlambley at gmail dot com
Description:
------------
Right now, it is not daylight savings in Adelaide, Australia. Converting a \DateTime object with
2037-10-04 or earlier into ISO 8601 (format 'c') correctly makes the time zone +09:30
However, any date beyond this will incorrectly add the daylight savings to the time zone +10:30
Please note that this issue may be time sensitive. If you're executing the code during the
Australian summer you may not be able to reproduce the results.
Confirmed not working on a freshly downloaded, unmodified version of PHP v7.2.7
Test script:
---------------
<?php
date_default_timezone_set('Australia/Adelaide');
$date1 = new DateTime('2037-10-05');
var_dump($date1->format('c'));
$date2 = new DateTime('2037-10-04');
var_dump($date2->format('c'));
Expected result:
----------------
string(25) "2037-10-05T00:00:00+09:30"
string(25) "2037-10-04T00:00:00+09:30"
Actual result:
--------------
string(25) "2037-10-05T00:00:00+10:30"
string(25) "2037-10-04T00:00:00+09:30"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76530&edit=1