From:             rpk at npstrategy dot com
Operating system: Linux Fedora Core 4
PHP version:      4.4.4
PHP Bug Type:     Date/time related
Bug description:  strtotime() generates wrong date for 11th month 2007 on.

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 bug report at http://bugs.php.net/?id=38781&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=38781&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=38781&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=38781&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=38781&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=38781&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=38781&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=38781&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=38781&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=38781&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=38781&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=38781&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=38781&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=38781&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38781&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=38781&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=38781&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=38781&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=38781&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=38781&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=38781&r=mysqlcfg

Reply via email to