Edit report at https://bugs.php.net/bug.php?id=68549&edit=1
ID: 68549
Updated by: yohgaki@php.net
Reported by: mfaust at usinternet dot com
Summary: Timezones and offsets are not properly used when
working with dates
Status: Open
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 5.6.3
Block user comment: N
Private report: N
New Comment:
http://3v4l.org/HGGjd
HHVM seems working correctly.
Previous Comments:
------------------------------------------------------------------------
[2014-12-05 05:22:55] mfaust at usinternet dot com
Description:
------------
Unix timestamps are not respected during daylight savings transitions. When specifying a timestamp
during a repeated hour, DateTime silently(incorrectly) modifies the timestamp to the previous hour.
In regards to the proposed https://wiki.php.net/rfc/datetime_and_daylight_saving_time
change, there are some current behaviors in regards to the "fall back" repeated hour that
sorely need to be addressed. For those that understand and need proper and accurate date/time
handling it is crucial that these inconsistent behaviors are eliminated.
Test script:
---------------
//A timestamp indicates a fixed point in time, irregardless of timezone and daylight savings, so PHP
must not change it when setting it:
$x = new DateTime();
$x->setTimezone(new DateTimezone('America/Chicago'));
$x->setTimestamp(1446357600);
echo $x->format('c') . "\n";
$x->setTimestamp(1446361200);
echo $x->format('c') . "\n"; //This should have a different offset since
it's outside DST
echo $x->getTimestamp();
//Simpler example
$x = new DateTime();
$x->setTimezone(new DateTimezone('America/Chicago'));
$x->setTimestamp(1446361200);
echo $x->getTimestamp(); //Returns a different timestamp. No apparent way to specify a timestamp
during the repeated hour.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68549&edit=1