note 92600 added to function.strtotime
| From: | php at davidstockton dot com | Date: | Fri, 31 Jul 2009 04:04:46 +0000 |
| Subject: | note 92600 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-158935@lists.php.net to get a copy of this message | ||
Adding a note to an already long page:
Try to be as specific as you can with the string you pass in. For example
<?php
echo date('F', strtotime('February'));
?>
is not specific enough. Depending on the day of the month, you may get a different response. For a
non-leap year, you'll get March if the _current day of the month_ is the 29th, 30th or 31st.
If it's a leap year, you'll get March on the 30th or 31st of the month. The same thing
will happen on the 31st of any month when you pass in the name of any month with less than 31 days.
This happens because the strtotime() function will fill in missing parts from the current day.
Assuming today is July 31, the timestamp returned by strtotime('February') will ultimately
be seen as February 31 (non-existant obviously), which then is interpreted as March 3, thus giving a
month name of March.
Interestingly, adding the year or the day will give you back the expected month.
----
Server IP: 209.41.74.194
Probable Submitter: 67.161.196.212
----
Manual Page -- http://www.php.net/manual/en/function.strtotime.php
Edit -- https://master.php.net/note/edit/92600
Del: integrated -- https://master.php.net/note/delete/92600/integrated
Del: useless -- https://master.php.net/note/delete/92600/useless
Del: bad code -- https://master.php.net/note/delete/92600/bad+code
Del: spam -- https://master.php.net/note/delete/92600/spam
Del: non-english -- https://master.php.net/note/delete/92600/non-english
Del: in docs -- https://master.php.net/note/delete/92600/in+docs
Del: other reasons-- https://master.php.net/note/delete/92600
Reject -- https://master.php.net/note/reject/92600
Search -- https://master.php.net/manage/user-notes.php