|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-01-18 16:26 UTC] mark at atlasdesignsolutions dot com
Description:
------------
strtotime is incorrectly evaluating second Tuesday for any month that starts on Tuesday.
Test script:
---------------
<?php
echo date('m-d-Y', strtotime('second tuesday Feburary 2011'));
echo date('m-d-Y', strtotime('second tuesday March 2011'));
// Correct Date
echo date('m-d-Y', strtotime('second tuesday April 2011'));
?>
Expected result:
----------------
02-08-2011
03-08-2011
04-12-2011
Actual result:
--------------
02-15-2011
03-15-2011
04-12-2011
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 00:00:01 2025 UTC |
This works in PHP 5.3 with the correct format, ie: <?php echo date('m-d-Y', strtotime('second tuesday of February 2011'))."\n"; echo date('m-d-Y', strtotime('second tuesday of March 2011'))."\n"; echo date('m-d-Y', strtotime('second tuesday of April 2011'))."\n"; ?> Outputs: 02-08-2011 03-08-2011 04-12-2011 Closing, since this works in 5.3 and 5.2 is end of lifed.