Bug #75780 [NEW]: strtotime() outputs wrong xth weekday
| From: | anubas at hotmail dot com | Date: | Mon, 08 Jan 2018 21:16:12 +0000 |
| Subject: | Bug #75780 [NEW]: strtotime() outputs wrong xth weekday | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-213429@lists.php.net to get a copy of this message | ||
From: anubas at hotmail dot com
Operating system: FreeBSD 11.1
PHP version: 7.2.1
Package: *Calendar problems
Bug Type: Bug
Bug description:strtotime() outputs wrong xth weekday
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 bug report at https://bugs.php.net/bug.php?id=75780&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75780&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75780&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75780&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75780&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75780&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75780&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75780&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75780&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75780&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75780&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75780&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75780&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75780&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75780&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75780&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75780&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75780&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75780&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75780&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75780&r=mysqlcfg