ID: 26154
User updated by: tnelson at wticorp dot com
Reported By: tnelson at wticorp dot com
Status: Bogus
Bug Type: Date/time related
Operating System: RedHat Linux 9.0
PHP Version: 4.3.3
New Comment:
Could we make this a feature request as opposed to a "bogus bug" then?
In the case of "dec 25 friday" the Day of Week Item isn't flagged an
error; it is completely ignored, as if the friday was not even there.
As for consistency with current strtotime functionality, the
aforementioned "Day of Week Item" documentation implies what its
behaviour should be and from a specification point of view it is
unambiguous.
I ask again because there is no way to simply 'throw' strtotime the
question:
"Give me the friday after december 25th"
unless I do it with an ugly workaound in two steps as in:
strtotime("friday",strtotime("dec 25"));
Previous Comments:
------------------------------------------------------------------------
[2003-11-06 14:32:32] [EMAIL PROTECTED]
You really can't throw strtotime just anything and expect it to work.
Notice the words 'try' and 'about any' in the manual for this
function..
------------------------------------------------------------------------
[2003-11-06 12:52:02] tnelson at wticorp dot com
Description:
------------
The day of week modifier when used with a "real" date does not advance
to that day of the week. I expected that the "explicit mention of a day
of the week will forward the date (only if necessary) to reach that day
of the week in the future."
The source of this expectation (aside from the fact that "next friday"
worked when I tried it) is the "Day of Week Item" section in the GNU
manual page referenced from the strtotime function documentation.
http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html
"next week friday" works as expected
"+3 weeks friday" works as expected
"dec 25 friday" does not work as expected. Instead it returns Thursday
December 25, 2003
"dec 25 +1 week friday" also does not work as expected. Instead it
returns Thursday January 1, 2004
Reproduce code:
---------------
echo date("l F j, Y ", strtotime("dec 25 friday");
Expected result:
----------------
Expected
Friday December 26, 2003
Actual result:
--------------
produces...
Thursday December 25, 2003
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26154&edit=1