php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53778 strtotime returning wrong result
Submitted: 2011-01-18 16:26 UTC Modified: 2011-01-19 04:07 UTC
From: mark at atlasdesignsolutions dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.17 OS: CentOS
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mark at atlasdesignsolutions dot com
New email:
PHP Version: OS:

 

 [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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-19 04:07 UTC] aharvey@php.net
-Status: Open +Status: Bogus
 [2011-01-19 04:07 UTC] aharvey@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 23 02:01:29 2024 UTC