Bug #62561 [Com]: DateTime add 'P1D' adds 25 hours
Edit report at https://bugs.php.net/bug.php?id=62561&edit=1
ID: 62561
Comment by: lonnyk at gmail dot com
Reported by: zach dot bailey at pardot dot com
Summary: DateTime add 'P1D' adds 25 hours
Status: Open
Type: Bug
Package: Date/time related
Operating System: Mac OS X 10.7.4
PHP Version: 5.3.14
Block user comment: N
Private report: N
New Comment:
This bug is the result of the fix for bug #55253 and bug #60236
Previous Comments:
------------------------------------------------------------------------
[2012-08-17 14:00:54] adam at lundrigan dot ca
Confirmed using PHP 5.3.16 (compiled from src) on RHEL 5.8
Failing PHPT test: https://github.com/adamlundrigan/php-src/blob/409bf5d888869aa2889d910af1b8edfe159febae/ext/date/tests/bug62561.phpt
------------------------------------------------------------------------
[2012-07-13 21:41:27] zach dot bailey at pardot dot com
Description:
------------
When a DateTime is constructed with a non-UTC timezone and one day is added, the
time also jumps forward by an hour as well.
Test script:
---------------
$ts = new DateTime('@1341115200', new DateTimeZone('America/New_York'));
$dayFromTs = new DateTime('@1341115200', new DateTimeZone('America/New_York'));
$dayFromTs->add(new DateInterval('P1D'));
echo 'ts: '.$ts->format('Y-m-d H:i:s')."\n";
echo 'day from ts: '.$dayFromTs->format('Y-m-d H:i:s')."\n";
Expected result:
----------------
ts: 2012-07-01 04:00:00
day from ts: 2012-07-02 04:00:00
Actual result:
--------------
ts: 2012-07-01 04:00:00
day from ts: 2012-07-02 05:00:00
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62561&edit=1
Thread (9 messages)