ID:               47735
 Updated by:       j...@php.net
 Reported By:      jmccombs at bloosky dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         Date/time related
 Operating System: Windows XP
 PHP Version:      5.2.9
 New Comment:

Please try using this snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to