#47735 [Com]: strtotime "weekday" keyword yields false results on weekends
| From: | inigoesdr+nospam at gmail dot com | Date: | Mon, 09 Nov 2009 15:39:31 +0000 |
| Subject: | #47735 [Com]: strtotime "weekday" keyword yields false results on weekends | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-144364@lists.php.net to get a copy of this message | ||
ID: 47735
Comment by: inigoesdr+nospam at gmail dot com
Reported By: jmccombs at bloosky dot com
Status: No Feedback
Bug Type: Date/time related
Operating System: Windows XP
PHP Version: 5.2.9
New Comment:
This appears to be fixed in PHP 5.2.11
Previous Comments:
------------------------------------------------------------------------
[2009-09-26 01:00:00] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2009-09-18 19:03:08] jani@php.net
Please try using this snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2009-03-20 17:17:53] jmccombs at bloosky dot com
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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47735&edit=1