php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76530 Timezone is incorrectly applied when converting dates beyond 2037
Submitted: 2018-06-26 03:52 UTC Modified: 2018-06-26 04:03 UTC
From: mlambley at gmail dot com Assigned:
Status: Duplicate Package: Scripting Engine problem
PHP Version: 7.2.7 OS: Windows 10, FreeBSD, others
Private report: No CVE-ID: None
 [2018-06-26 03:52 UTC] 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"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-26 04:03 UTC] requinix@php.net
-Status: Open +Status: Duplicate
 [2018-06-26 04:03 UTC] requinix@php.net
Duplicate of bug #64992
 [2018-06-26 04:28 UTC] a at b dot c dot de
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));
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Oct 16 04:01:27 2024 UTC