note 113927 added to class.dateinterval

From: Date: Wed, 18 Dec 2013 08:03:32 +0000
Subject: note 113927 added to class.dateinterval
Groups: php.notes 
Request: Send a blank email to php-notes+get-197969@lists.php.net to get a copy of this message
I had the doubt after reading this page on how to create negative intervals. So far the only solution is to create the interval and negativize it. <?php $date1 = new DateTime(); $eightynine_days_ago = new DateInterval( "P89D" ); $eightynine_days_ago->invert = 1; //Make it negative. $date1->add( $eightynine_days_ago ); ?> and then $date1 is now 89 days in the past. This information is extracted from another php comment http://www.php.net/manual/en/dateinterval.construct.php#102976 but this page seems to be the first place where people will look for it. ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/class.dateinterval.php Edit -- https://master.php.net/note/edit/113927 Del: integrated -- https://master.php.net/note/delete/113927/integrated Del: useless -- https://master.php.net/note/delete/113927/useless Del: bad code -- https://master.php.net/note/delete/113927/bad+code Del: spam -- https://master.php.net/note/delete/113927/spam Del: non-english -- https://master.php.net/note/delete/113927/non-english Del: in docs -- https://master.php.net/note/delete/113927/in+docs Del: other reasons-- https://master.php.net/note/delete/113927 Reject -- https://master.php.net/note/reject/113927 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#197969) next »