note 107610 added to dateinterval.construct
| From: | jawzx01 at gmail dot com | Date: | Tue, 21 Feb 2012 22:43:54 +0000 |
| Subject: | note 107610 added to dateinterval.construct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186262@lists.php.net to get a copy of this message | ||
As previously mentioned, to do a negative DateInterval object, you'd code:
$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.
----
Server IP: 69.147.83.197
Probable Submitter: 208.255.167.194
----
Manual Page -- http://www.php.net/manual/en/dateinterval.construct.php
Edit -- https://master.php.net/note/edit/107610
Del: integrated -- https://master.php.net/note/delete/107610/integrated
Del: useless -- https://master.php.net/note/delete/107610/useless
Del: bad code -- https://master.php.net/note/delete/107610/bad+code
Del: spam -- https://master.php.net/note/delete/107610/spam
Del: non-english -- https://master.php.net/note/delete/107610/non-english
Del: in docs -- https://master.php.net/note/delete/107610/in+docs
Del: other reasons-- https://master.php.net/note/delete/107610
Reject -- https://master.php.net/note/reject/107610
Search -- https://master.php.net/manage/user-notes.php