Edit report at https://bugs.php.net/bug.php?id=55015&edit=1
ID: 55015 User updated by: cp at ltur dot de Reported by: cp at ltur dot de Summary: strToTime calculates wrong date Status: Open Type: Bug Package: Date/time related Operating System: Linux PHP Version: 5.3.6 Block user comment: N Private report: N New Comment: Hi, i applied the patch from lonny and it works for me :-) php > date_default_timezone_set('Europe/Berlin'); php > echo date('Ymd N', strToTime('next month next Monday', mktime(0,0,0,6,9,2011))); // prints 20110711 1 Will somebody commit his patch? kind regards .cp Previous Comments: ------------------------------------------------------------------------ [2011-07-06 02:10:07] lonnyk at gmail dot com The problem is that the relative weekday was calculated before the relative month/year. I attached a batch and a test to change the order of the calculation. ------------------------------------------------------------------------ [2011-07-01 04:52:27] lonnyk at gmail dot com I also found that if you are using this code and the next Monday is in the next month then the month will advance two months. I set the date to 20110630 and ran the exact same test script: lonny@lonnydev:~/php/php-src-5.3$ sudo date -s "30 JUN 2011 10:00:00" Thu Jun 30 10:00:00 EDT 2011 lonny@lonnydev:~/php/php-src-5.3$ php ~/test.php 20110804 4 ------------------------------------------------------------------------ [2011-06-09 14:13:00] cp at ltur dot de Description: ------------ Hi, strToTime calculates a "Wednesday" when i asked for a "Monday". php 5.3.6 Configure Command => './configure' '--disable-cgi' '--with-libedit' PHP API => 20090626 PHP Extension => 20090626 Zend Extension => 220090626 Zend Extension Build => API220090626,NTS PHP Extension Build => API20090626,NTS Test script: --------------- // today Y-m-d 2011-06-09 date_default_timezone_set('Europe/Berlin'); echo date('Ymd N', strToTime('next month next Monday')); Expected result: ---------------- 20110711 1 Actual result: -------------- 20110713 3 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55015&edit=1