Bug #67853 [Opn->Nab]: strtotime() incorrect handles relative dates
| From: | rasmus@php.net | Date: | Mon, 18 Aug 2014 03:41:44 +0000 |
| Subject: | Bug #67853 [Opn->Nab]: strtotime() incorrect handles relative dates | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187159@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67853&edit=1
ID: 67853
Updated by: rasmus@php.net
Reported by: bugs at oliverboorman dot biz
Summary: strtotime() incorrect handles relative dates
-Status: Open
+Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: Windows
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
You actually have to use complete expressions here. It is an English-parsing function and in English
you would say, "second saturday of August 2015" in which case you get your expected
result.
Previous Comments:
------------------------------------------------------------------------
[2014-08-17 19:58:30] bugs at oliverboorman dot biz
On the doc page for the strtotime() function (http://uk3.php.net/manual/en/function.strtotime.php),
it is mention that:
"In PHP 5 prior to 5.2.7, requesting a given occurrence of a given weekday in a month where
that weekday was the first day of the month would incorrectly add one week to the returned
timestamp. This has been corrected in 5.2.7 and later versions."
However, this issues is observable on version 5.2.14.
------------------------------------------------------------------------
[2014-08-17 19:34:43] bugs at oliverboorman dot biz
Description:
------------
When passing date strings such as "second Saturday August 2015" to strtotime(), the wrong
output is returned. The "first", "second" or "third" qualifiers seem
to use the wrong index in certain cases.
For example, in 2015, the first day of August will be a Saturday so this should be considered the
first Saturday of August. However, the function seems to treat it as the zeroth Saturday.
Test script:
---------------
$test = strtotime("second Saturday August 2015");
echo date("d M Y h:i" $test);
Expected result:
----------------
08 Aug 2015 12:00
Actual result:
--------------
15 Aug 2015 12:00
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67853&edit=1