note 102605 rejected from datetime.sub by danbrown

From: Date: Thu, 24 Feb 2011 15:07:04 +0000
Subject: note 102605 rejected from datetime.sub by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-177292@lists.php.net to get a copy of this message
Note Submitter: adam dot myszak at webchili dot pl ---- Why sub method wrong subtracts on that DateInterval example? $actualDate = new DateTime('24-02-2011'); $oldDate = clone $actualDate; $interval = new DateInterval('P1W2D'); // 1Week2Days $actualDate->sub($interval); echo $actualDate->format('d-m-Y'); // Why 22-02-2011 ?! echo $oldDate->modify('-1 week -2 day')->format('d-m-Y'); // 15-02-2011

« previous php.notes (#177292) next »