Bug #75780 [Opn->Nab]: strtotime() outputs wrong xth weekday

From: Date: Mon, 08 Jan 2018 21:54:20 +0000
Subject: Bug #75780 [Opn->Nab]: strtotime() outputs wrong xth weekday
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213430@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75780&edit=1 ID: 75780 Updated by: requinix@php.net Reported by: anubas at hotmail dot com Summary: strtotime() outputs wrong xth weekday -Status: Open +Status: Not a bug Type: Bug -Package: *Calendar problems +Package: Date/time related Operating System: FreeBSD 11.1 PHP Version: 7.2.1 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php http://php.net/manual/en/datetime.formats.relative.php "third monday" is a relative term. You want "third monday of". Previous Comments: ------------------------------------------------------------------------ [2018-01-08 21:16:11] anubas at hotmail dot com Description: ------------ strtotime() outputs the xth + 1 weekday instead of the xth weekday when the defined month starts on the defined weekday. Example: The expected output of strtotime('January 2018 third Monday') is the timestamp for '2018-01-15', which is the third Monday of January 2018. Instead, strtotime() outputs the timestamp for '2018-01-22', which is the fourth Monday of January 2018 because that month starts on a Monday. Test script: --------------- print 'Expected: 2018-01-15. Result: ' . date('Y-m-d', strtotime('january 2018 third monday')); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75780&edit=1

« previous php.bugs (#213430) next »