Bug #63227 [Com]: strtotime - weekday in a month where that weekday was the first day adds 1 week

From: Date: Sat, 13 Feb 2016 13:43:51 +0000
Subject: Bug #63227 [Com]: strtotime - weekday in a month where that weekday was the first day adds 1 week
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199191@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63227&edit=1 ID: 63227 Comment by: murden at gmail dot com Reported by: helgeson dot b at gmail dot com Summary: strtotime - weekday in a month where that weekday was the first day adds 1 week Status: Verified Type: Bug Package: Date/time related Operating System: * PHP Version: 7.0.1 Block user comment: N Private report: N New Comment: I've found something that seems to be related? running strtotime on a string like ("2nd monday") adds a week to the date on months where the requested week day is the 1st day of the month. Like, will also happen on ("1st Saturday") when the month starts on a Saturday. Previous Comments: ------------------------------------------------------------------------ [2015-12-25 12:36:54] cmb@php.net > Maybe update the documentation to reflect the version the bug > was actually corrected in? Bug #43452 has been fixed as of PHP 5.2.7[1], but apparently the fix only affects week numbers given as proper number[2], but not as ordinal string[3]. [1] <https://3v4l.org/I4HLT> [2] <https://3v4l.org/GUdnb> [3] <https://3v4l.org/LhGLZ> ------------------------------------------------------------------------ [2012-10-05 19:06:50] helgeson dot b at gmail dot com Description: ------------ --- From manual page: http://www.php.net/function.strtotime#refsect1- function.strtotime-changelog --- 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. Although this was reported resolved as of PHP 5.2.7, it still exists in PHP 5.3.17. ------------------------------------------------------------------------ [2012-10-05 19:04:59] helgeson dot b at gmail dot com Description: ------------ --- From manual page: http://www.php.net/function.strtotime#refsect1- function.strtotime-changelog --- 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. Although this was reported resolved as of PHP 5.2.7, it still exists in PHP 5.3.3. Maybe update the documentation to reflect the version the bug was actually corrected in? Test script: --------------- $x = strtotime('Second Monday October 2012'); print date('Y-m-d', $x); Expected result: ---------------- 2012-10-8 Actual result: -------------- 2012-10-15 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63227&edit=1

« previous php.bugs (#199191) next »