note 124572 added to class.dateinterval
| From: | youssef dot benhssaien at gmail dot com | Date: | Tue, 07 Jan 2020 20:38:39 +0000 |
| Subject: | note 124572 added to class.dateinterval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-213801@lists.php.net to get a copy of this message | ||
Note that to get the next day (like : +1 day, +1 week, ...)
<?php $date = date_create('last monday of december last
year')->add(\DateInterval::createFromDateString('+1 monday')); ?>
will not return the next monday, but the same monday passed as date_create() parameter.
To get the next monday even pass +2 instead of +1 or next monday :
<?php $date = date_create('last monday of december last
year')->add(\DateInterval::createFromDateString('next monday')); ?>
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.168 (proxied: 2a01:e35:242d:22e0:6d2b:1d5f:7854:5dfa)
----
Manual Page -- http://php.net/manual/en/class.dateinterval.php
Edit -- https://master.php.net/note/edit/124572
Del: integrated -- https://master.php.net/note/delete/124572/integrated
Del: useless -- https://master.php.net/note/delete/124572/useless
Del: bad code -- https://master.php.net/note/delete/124572/bad+code
Del: spam -- https://master.php.net/note/delete/124572/spam
Del: non-english -- https://master.php.net/note/delete/124572/non-english
Del: in docs -- https://master.php.net/note/delete/124572/in+docs
Del: other reasons-- https://master.php.net/note/delete/124572
Reject -- https://master.php.net/note/reject/124572
Search -- https://master.php.net/manage/user-notes.php