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
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: marcus at betoptions dot com
New email:
PHP Version: OS:

 

 [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: Fri Nov 01 01:01:28 2024 UTC