Edit report at https://bugs.php.net/bug.php?id=51051&edit=1
ID: 51051 Comment by: dani...@php.net Reported by: mehdi dot rande at aliasource dot fr Summary: DateTime modify wrong result with DST change Status: Assigned Type: Bug Package: Date/time related Operating System: Linux PHP Version: 5.3.1 Assigned To: derick Block user comment: N Private report: N New Comment: This will be addressed by https://wiki.php.net/rfc/datetime_and_daylight_saving_time Previous Comments: ------------------------------------------------------------------------ [2011-04-18 17:30:09] halde at freenet dot de reproduced issue of previous poster on a linux machine (timestamps are not equal): $ php -a Interactive shell php > $dt = new DateTime('now', new DateTimeZone('Europe/Berlin')); php > $dt->setTimestamp(1288483200); php > echo $dt->getTimestamp(); 1288486800 php > echo phpversion(); 5.3.3-1ubuntu9.3 php > exit $ uname -a Linux wum128229 2.6.35-28-generic #49-Ubuntu SMP Tue Mar 1 14:39:03 UTC 2011 x86_64 GNU/Linux ------------------------------------------------------------------------ [2011-02-24 17:07:56] j dot ek at gmx dot net Think I found a related issue, reproduce it with: <?php $dt = new DateTime('now', new DateTimeZone('Europe/Berlin')); // try to set timestamp of 2010-10-31T02:00:00+0200 $dt->setTimestamp(1288483200); // but returns timestamp of 2010-10-31T02:00:00+0100 echo $dt->getTimestamp(); // outputs 1288486800 ?> WinXP 32, PHP 5.3.2 (cli) (built: Mar 3 2010 20:36:54) ------------------------------------------------------------------------ [2010-12-25 02:46:45] danielc at analysisandsolutions dot com DateTime::diff() is similarly afflicted with daylight/standard change over issues. Naturally, diff/add/sub all need to be in sync so intervals returned by diff can be passed to add/sub and produce the original datetime. ------------------------------------------------------------------------ [2010-12-25 02:27:22] dani...@php.net I just attached a test script that covers issues in the spring and fall. ------------------------------------------------------------------------ [2010-12-25 02:26:16] dani...@php.net The following patch has been added/updated: Patch Name: bug51051test.php.txt Revision: 1293240376 URL: http://bugs.php.net/patch-display.php?bug=51051&patch=bug51051test.php.txt&revision=1293240376 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=51051 -- Edit this bug report at https://bugs.php.net/bug.php?id=51051&edit=1