Edit report at https://bugs.php.net/bug.php?id=55015&edit=1

 ID:                 55015
 Comment by:         lonnyk at gmail dot com
 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:

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.


Previous Comments:
------------------------------------------------------------------------
[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

Reply via email to