|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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"
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 14:00:01 2025 UTC |
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));