Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53367 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24190 invoked from network); 18 Jun 2011 01:05:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2011 01:05:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=danielc@analysisandsolutions.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=danielc@analysisandsolutions.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain analysisandsolutions.com from 166.84.1.89 cause and error) X-PHP-List-Original-Sender: danielc@analysisandsolutions.com X-Host-Fingerprint: 166.84.1.89 mailbackend.panix.com Solaris 10 (beta) Received: from [166.84.1.89] ([166.84.1.89:65437] helo=mailbackend.panix.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A0/99-49199-7C9FBFD4 for ; Fri, 17 Jun 2011 21:05:12 -0400 Received: from panix3.panix.com (panix3.panix.com [166.84.1.3]) by mailbackend.panix.com (Postfix) with ESMTP id 0303132776; Fri, 17 Jun 2011 21:05:09 -0400 (EDT) Received: by panix3.panix.com (Postfix, from userid 14662) id 264228FDDE; Fri, 17 Jun 2011 21:05:09 -0400 (EDT) Date: Fri, 17 Jun 2011 21:05:09 -0400 To: Stas Malyshev Cc: PHP Internals , Derick Rethans Message-ID: <20110618010507.GA3275@panix.com> References: <4DFA96ED.90800@sugarcrm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4DFA96ED.90800@sugarcrm.com> User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: [PHP-DEV] date_diff broken? From: danielc@analysisandsolutions.com (Daniel Convissor) 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: 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