#46932 [Opn->Csd]: strtotime() has inconsistency between 'next Monday' and '+1 Monday'

From: Date: Tue, 15 Sep 2009 06:52:35 +0000
Subject: #46932 [Opn->Csd]: strtotime() has inconsistency between 'next Monday' and '+1 Monday'
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2775@lists.php.net to get a copy of this message
ID: 46932 Updated by: torben@php.net Reported By: for-bugs at hnw dot jp -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: any PHP Version: 5.2.8 New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2009-09-15 06:28:00] svn@php.net Automatic comment from SVN on behalf of torben Revision: http://svn.php.net/viewvc/?view=revision&revision=288346 Log: Documented the old incorrect behaviour that requesting a given occurrence of a weekday in a month when that weekend occurred on the first day of the month would add one week to the returned timestamp. Addresses bug #46932 Not sure this should be a warning. Seems more appropriate in the changelog section. I'm just putting it here now to be consistent with the existing function reference. ------------------------------------------------------------------------ [2009-05-11 08:50:32] jani@php.net Both PHP_5_2 and PHP_5_3 output same now. ------------------------------------------------------------------------ [2009-01-15 08:39:24] for-bugs at hnw dot jp How about PHP 5.2.8? PHP 5.2.8 also does same behavior. I think this behavior is introduced by fix #43452. http://bugs.php.net/bug.php?id=43452 The bug ticket has been closed, but this confused behaviour is not documented. ------------------------------------------------------------------------ [2008-12-23 14:14:18] derick@php.net 5.3 does the proper behavior. ------------------------------------------------------------------------ [2008-12-23 06:18:53] for-bugs at hnw dot jp Description: ------------ With PHP 5.2.8 or 5.3.0alpha3, 'next Monday' and '+1 Monday' is diffrenet. On Monday, 'next Monday' seems the same day. However, '+1 Monday' means 1 week later. 'next day' and '+1 day' performs the same behavior, so it is natural to me that 'next Monday' and '+1 Monday' is the same meanings. In addition, my GNU date command never accept '+1 Monday' and 'next Monday' on Monday means the same day. So, I cannot tell what is the right behavior. I only report inconsistency. Reproduce code: --------------- <?php var_dump(date("Y-m-d",strtotime("+1 Monday 2008-12-01"))); var_dump(date("Y-m-d",strtotime("next Monday 2008-12-01"))); Actual result: -------------- string(10) "2008-12-01" string(10) "2008-12-08" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46932&edit=1

« previous php.doc.bugs (#2775) next »