Hi Stas: > $start = new DateTime('2010-10-04 02:18:48 EDT'); > $end = new DateTime('2010-11-06 18:38:28 EDT'); > $int = $start->diff($end); ... snip ... > As you can see, the date in $start changed, even though it shouldn't > happen.
Funny you should mention that now. I ran into the same exact issue as I was reworking the DateTime unit tests yesterday. I came up with a .phpt for it, and another one for a similar problem with DateTime::add(), though I was waiting to commit them until bugs.php.net was back up so I could get bug numbers for them. I just updated my checkout and the diff() problem is fixed, but the add() one still exists. bug.add.zone2.phpt has now been committed. In brief, calling add() on DateTime objects with zone type2 pushes back the time by an hour. For example: <?php $interval = new DateInterval('PT2H1M'); $date2 = new DateTime('2010-10-04 02:18:48 EDT'); echo $interval->format('Add %h hours %i minutes') . "\n"; $date2->add($interval); echo 'Zone Type 2: ' . $date2->format('Y-m-d H:i:s T') . "\n"; ?> Output: Zone Type 2: 2010-10-04 03:19:48 EDT Expected: Zone Type 2: 2010-10-04 04:19:48 EDT Thanks, --Dan -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php