note 102605 added to datetime.sub

From: Date: Thu, 24 Feb 2011 10:40:36 +0000
Subject: note 102605 added to datetime.sub
Groups: php.notes 
Request: Send a blank email to php-notes+get-177275@lists.php.net to get a copy of this message
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 ---- Server IP: 82.177.164.100 Probable Submitter: 212.182.93.162 ---- Manual Page -- http://www.php.net/manual/en/datetime.sub.php Edit -- https://master.php.net/note/edit/102605 Del: integrated -- https://master.php.net/note/delete/102605/integrated Del: useless -- https://master.php.net/note/delete/102605/useless Del: bad code -- https://master.php.net/note/delete/102605/bad+code Del: spam -- https://master.php.net/note/delete/102605/spam Del: non-english -- https://master.php.net/note/delete/102605/non-english Del: in docs -- https://master.php.net/note/delete/102605/in+docs Del: other reasons-- https://master.php.net/note/delete/102605 Reject -- https://master.php.net/note/reject/102605 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#177275) next »