|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-09-18 19:03 UTC] jani@php.net
[2009-09-26 01:00 UTC] php-bugs at lists dot php dot net
[2009-11-09 15:39 UTC] inigoesdr+nospam at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 09:00:01 2025 UTC |
Description: ------------ In strtotime, using the keyword "weekday" to calculate a date yields false results when: - starting from a weekend date (including Friday) - AND end date lands on a weekend Reproduce code: --------------- <?php echo date("Y-m-d", strtotime("2009-03-20 +5 weekday"))."\n"; //EXPECT: 2009-03-27. RETURNS: 2009-03-29 echo date("l", strtotime("friday +5 weekday"))."\n"; //EXPECT: "Friday". RETURNS: "Sunday" ## Works fine as long as start date is not a weekend... echo date("l", strtotime("thursday +6 weekday"))."\n"; //EXPECT: "Friday". RETURNS: "Friday" ## ...OR end date does not land on weekend: echo date("l", strtotime("friday +4 weekday"))."\n"; //EXPECT: "Thursday". RETURNS: "Thursday" ?> Expected result: ---------------- 2009-03-27 Friday Friday Thursday Actual result: -------------- 2009-03-29 Sunday Friday Thursday