ID:               41873
 User updated by:  kevin at creativeanvil dot com
 Reported By:      kevin at creativeanvil dot com
-Status:           No Feedback
+Status:           Open
 Bug Type:         Date/time related
 Operating System: RHEL 4
 PHP Version:      5.2.3
 New Comment:

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.


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

[2007-07-12 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".

------------------------------------------------------------------------

[2007-07-04 11:23:18] [EMAIL PROTECTED]

So how to reproduce it?

------------------------------------------------------------------------

[2007-07-03 19:30:53] kevin at creativeanvil dot com

Yes, most of the time it is correct, but I've found if the day wanted
is the last day of the month, it may not work correctly.  Friday was an
example, it probably has nothing to do with Friday specifically, that's
just what I tested and found the problem.

------------------------------------------------------------------------

[2007-07-03 06:44:47] [EMAIL PROTECTED]

Works perfectly fine here:
10/26/2007
07/27/2007

------------------------------------------------------------------------

[2007-07-02 15:13:26] 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


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=41873&edit=1

Reply via email to