php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51505 strotime incorrect when looking at days this week or last
Submitted: 2010-04-08 05:35 UTC Modified: 2010-04-08 05:56 UTC
From: marcus at betoptions dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.13 OS: Linux
Private report: No CVE-ID: None
 [2010-04-08 05:35 UTC] marcus at betoptions dot com
Description:
------------
When using strtotime to determine the date of a particular day last week or next week using a given value for $now we get results that we would not be expecting. I get the values I am expecting when using PHP 5.3.2

Test script:
---------------
$time = mktime(0, 0, 0, 4, 7, 2010);
echo date('Y-m-d H:i:s', strtotime('Tuesday last week', $time));
echo "\n";
echo date('Y-m-d H:i:s', strtotime('Tuesday this week', $time));

Expected result:
----------------
2010-03-30 00:00:00
2010-04-06 00:00:00


Actual result:
--------------
2010-04-06 00:00:00
2010-04-13 00:00:00


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-08 05:56 UTC] rasmus@php.net
-Status: Open +Status: Bogus
 [2010-04-08 05:56 UTC] rasmus@php.net
Yes, we made strtotime() a bit smarter in 5.3.  Since there is a chance of a 
backward-compatibility break here, we can't fix this in the 5.2 tree.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC