|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-06-09 14:13 UTC] 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
Patchescalc_rel_weekday_after_month_year_test (last revision 2011-07-06 06:08 UTC by lonnyk at gmail dot com)calc_rel_weekday_after_month_year (last revision 2011-07-06 06:08 UTC by lonnyk at gmail dot com) Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 01 05:00:01 2025 UTC |
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 .cpWe can't just randomly change the order because other people may rely on it. What you want to do is really this: $date = date_create("2011-06-09 00:00:00")->modify("next month")->modify("next monday");