Edit report at https://bugs.php.net/bug.php?id=62561&edit=1

 ID:                 62561
 Comment by:         adam at lundrigan dot ca
 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:

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


Previous Comments:
------------------------------------------------------------------------
[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

Reply via email to