|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-09-11 18:29 UTC] tony2001@php.net
[2006-09-11 21:28 UTC] rpk at npstrategy dot com
[2006-09-12 08:31 UTC] tony2001@php.net
[2007-02-03 23:13 UTC] danielc@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 07:00:01 2025 UTC |
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.