note 118784 added to dateinterval.construct
| From: | userexamplecom at mailinator dot com | Date: | Fri, 05 Feb 2016 13:49:24 +0000 |
| Subject: | note 118784 added to dateinterval.construct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204869@lists.php.net to get a copy of this message | ||
Take care, if you have a DateTime Object on the 31h of January and add Da DateInterval of one Month,
then you are in March instead of February.
For Example:
---
// given the actual date is 2017-01-31
$today = new DateTime('now', $timeZoneObject);
$today->add(new DateInterval('P1M'));
echo $today->format('m');
// output: 03
---
----
Server IP: 72.52.91.14
Probable Submitter: 93.93.254.242
----
Manual Page -- http://php.net/manual/en/dateinterval.construct.php
Edit -- https://master.php.net/note/edit/118784
Del: integrated -- https://master.php.net/note/delete/118784/integrated
Del: useless -- https://master.php.net/note/delete/118784/useless
Del: bad code -- https://master.php.net/note/delete/118784/bad+code
Del: spam -- https://master.php.net/note/delete/118784/spam
Del: non-english -- https://master.php.net/note/delete/118784/non-english
Del: in docs -- https://master.php.net/note/delete/118784/in+docs
Del: other reasons-- https://master.php.net/note/delete/118784
Reject -- https://master.php.net/note/reject/118784
Search -- https://master.php.net/manage/user-notes.php