Bug #67853 [Opn]: strtotime() incorrect handles relative dates

From: Date: Sun, 17 Aug 2014 19:58:30 +0000
Subject: Bug #67853 [Opn]: strtotime() incorrect handles relative dates
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187158@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 User updated by: bugs at oliverboorman dot biz Reported by: bugs at oliverboorman dot biz Summary: strtotime() incorrect handles relative dates Status: Open Type: Bug Package: Date/time related Operating System: Windows PHP Version: Irrelevant Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#187158) next »