|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-07-02 15:13 UTC] kevin at creativeanvil dot com
Description:
------------
For the last friday of the month for several months it is incorrect. Tends to happen when the last day of the month is on the date you're looking for.
Reproduce code:
---------------
$stamp = strtotime("last Friday", gmmktime(0,0,0,11,0,2007);
echo date("m/d/Y", $stamp)."<br>;
$stamp = strtotime("last Friday", gmmktime(0,0,0,8,0,2007);
echo date("m/d/Y", $stamp);
Expected result:
----------------
11/30/2007
8/31/2007
Actual result:
--------------
11/23/2007
8/24/2007
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 14:00:01 2025 UTC |
Doing this: <?php $stamp = strtotime("last Friday", gmmktime(0,0,0,11+1,0,2007)); echo date("m/d/Y", $stamp)."<br>"; $stamp = strtotime("last Friday", gmmktime(0,0,0,8+1,0,2007)); echo date("m/d/Y", $stamp); ?> Expected Value: 11/30/2007 08/31/2007 Actual Value 11/23/2007 08/24/2007 That should make more sense. Again this seems to happen when the last day of the month is the last Friday that we're looking for, then it returns the previous Friday.