note 69296 added to function.strtotime
| From: | adrian at osu1 dot php dot net | Date: | Wed, 30 Aug 2006 14:51:15 +0000 |
| Subject: | note 69296 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116509@lists.php.net to get a copy of this message | ||
re: horvathi
Actually, the person replying to your post is correct. Here it is, straight from the manual's
mouth:
"The fuzz in units can cause problems with relative items. For example, '2003-07-31 -1
month' might evaluate to 2003-07-01, because 2003-06-31 is an invalid date. To determine the
previous month more reliably, you can ask for the month before the 15th of the current month."
"-1 month" and "-30 days" are not equal. "month" causes the function
to work directly on the month value of the date, only adjusting the year if your roll forward or
backward too many months. The day piece of the date is untouched, allowing for invalid dates which
are then transformed into valid dates.
Regards,
Adrian
----
Server IP: 66.163.161.117
Probable Submitter: 71.4.114.2
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.strtotime.php
Edit -- https://master.php.net/note/edit/69296
Del: integrated -- https://master.php.net/note/delete/69296/integrated
Del: useless -- https://master.php.net/note/delete/69296/useless
Del: bad code -- https://master.php.net/note/delete/69296/bad+code
Del: spam -- https://master.php.net/note/delete/69296/spam
Del: non-english -- https://master.php.net/note/delete/69296/non-english
Del: in docs -- https://master.php.net/note/delete/69296/in+docs
Del: other reasons-- https://master.php.net/note/delete/69296
Reject -- https://master.php.net/note/reject/69296
Search -- https://master.php.net/manage/user-notes.php