|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-01-12 20:53 UTC] heiglandreas@php.net
-Status: Open
+Status: Not a bug
[2017-01-12 20:53 UTC] heiglandreas@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
Description: ------------ I was attempting to strtotime to find the last (specific) day of the month. Example: Last Monday of May But it returns false. I ended up taking a different approach but this would have been a nice feature. Also tried: Last Monday April Which did not return the results I was expecting. Maybe we can get a little more documentation on this function and what terms it accepts? (If this exists, I was unable to find it) Test script: --------------- $f = "Y-m-d";$now = 1267571715; // 2010-03-02 echo "<pre>"; echo date($f, strtotime("last Monday",$now))."\n"; echo date($f, strtotime("last Monday in March",$now))."\n"; echo date($f, strtotime("last Monday of March",$now))."\n"; echo date($f, strtotime("last Monday April",$now))."\n"; echo date($f, strtotime("last Monday in April",$now))."\n"; echo date($f, strtotime("last Monday of April",$now))."\n"; echo "</pre>"; Expected result: ---------------- 2010-03-01 2010-03-29 2010-03-29 2010-04-26 2010-04-26 2010-04-26 Actual result: -------------- 2010-03-01 (ok) 1969-12-31 (nothing returned) 1969-12-31 (nothing returned) 2010-03-29 (unexpected, but valid) 1969-12-31 (nothing returned) 1969-12-31 (nothing returned)