|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2003-11-06 12:52 UTC] 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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 12:00:01 2025 UTC | 
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"));