note 91977 added to datetime.modify
| From: | tacker@php.net | Date: | Fri, 03 Jul 2009 10:18:44 +0000 |
| Subject: | note 91977 added to datetime.modify | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-157872@lists.php.net to get a copy of this message | ||
Do not use '[+/-]{n} month' to get the last day
of the month.
If you use '+1 month' on the first of the month,
it sets the date to the next first of the month.
This behaviour gives the impression, that php
considers the length of a month, which is not true.
Basically if you use '+1 month' it takes the
month number, adds 1 and parses result as a
new date.
But if you use '+1 month' on the last day of
a month, the result is unexpected as 2009-05-31
becomes 2009-06-31 which is an invalid date and
then interpreted as 2009-07-01.
----
Server IP: 69.147.83.197
Probable Submitter: 217.17.17.146
----
Manual Page -- http://www.php.net/manual/en/datetime.modify.php
Edit -- https://master.php.net/note/edit/91977
Del: integrated -- https://master.php.net/note/delete/91977/integrated
Del: useless -- https://master.php.net/note/delete/91977/useless
Del: bad code -- https://master.php.net/note/delete/91977/bad+code
Del: spam -- https://master.php.net/note/delete/91977/spam
Del: non-english -- https://master.php.net/note/delete/91977/non-english
Del: in docs -- https://master.php.net/note/delete/91977/in+docs
Del: other reasons-- https://master.php.net/note/delete/91977
Reject -- https://master.php.net/note/reject/91977
Search -- https://master.php.net/manage/user-notes.php