ID:               38781
 User updated by:  rpk at npstrategy dot com
 Reported By:      rpk at npstrategy dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         Date/time related
 Operating System: Linux Fedora Core 4
 PHP Version:      4.4.4
 New Comment:

running program
http://southo.org/date_test.php


Code:

$month11_2006_timestamp = mktime(0,0,0,11,1,2006);

$month11_2006_day_timestamp = strtotime("3
Friday",$month11_2006_timestamp);

$month11_2006_date = date('j',$month11_2006_day_timestamp);

echo"<h1>month11_2006_date for Friday 2006 = $month11_2006_date
(correct)</h1>";


$month11_2007_timestamp = mktime(0,0,0,11,1,2007);

$month11_2007_day_timestamp = strtotime("3
Friday",$month11_2007_timestamp);

$month11_2007_date = date('j',$month11_2007_day_timestamp);

echo"<h1>month11_2007_date = $month11_2007_date (wrong)</h1>";


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

[2006-09-11 18:29:09] [EMAIL PROTECTED]

Can't reproduce with both 4.4 and 5.2.

I get 17 and 16, both are correct results.

Also, please try to be more clear when you provide reproduce code. Lot
of HTML and text do not add any understanding.

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

[2006-09-11 18:16:17] rpk at npstrategy dot com

Description:
------------
strtotime starts generating wrong timestamps in November, 2007.  Only
wrong in the month of November.  Rest of months are ok.

strtotime("3 Friday", $november_2006_timestamp) generates correct
timestamp with date which is the 3rd Friday in November 2006.

strtotime("3 Friday", $november_2007_timestamp) generates wrong
timestamp with date which should be the 3rd Friday in November 2007. 
The date generated is -1 day, in this case, Thursday in the month of
November, 2007.

All dates generated are wrong in the months of November.  Tested up to
2009.  Every other month works ok.




Reproduce code:
---------------
<?php
$month11_2006_timestamp = mktime(0,0,0,11,1,2006);

$month11_2006_day_timestamp = strtotime("3
Friday",$month11_2006_timestamp);

$month11_2006_date = date('j',$month11_2006_day_timestamp);

echo"<h1>month11_2006_date for Friday 2006 = $month11_2006_date
(correct)</h1>";

echo"<h1>This correctly shows the 3rd Friday date for November, 2006
</h1>";

//test of strtotime() generating date string for day in 3 week in
November 2007

$month11_2007_timestamp = mktime(0,0,0,11,1,2007);

$month11_2007_day_timestamp = strtotime("3
Friday",$month11_2007_timestamp);

$month11_2007_date = date('j',$month11_2007_day_timestamp);

echo"<h1>month11_2007_date = $month11_2007_date (wrong)</h1>";

echo"<h1>This incorrectly shows the 3rd Friday date for November, 2007

         <br>as the 15th of November 2007 which is a Thursday.
         <p>Every day-date generated from November 2007-2009 produces at -1
day from the standard.
             So other days are also wrong.  It is always November. The other
months work fine.</p></h1>";

Expected result:
----------------
month11_2006_date for Friday 2006 = 17 (correct)
This correctly shows the 3rd Friday date for November, 2006
month11_2007_date = 15 (wrong)
This incorrectly shows the 3rd Friday date for November, 2007
as the 15th of November 2007 which is a Thursday.

Every day-date generated from November 2007-2009 produces at -1 day
from the standard. So other days are also wrong. It is always November.
The other months work fine.



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


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

Reply via email to