#18670 [Ver->Ana]: strtotime() bug
| From: | rasmus@php.net | Date: | Wed, 31 Jul 2002 14:39:11 +0000 |
| Subject: | #18670 [Ver->Ana]: strtotime() bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-15683@lists.php.net to get a copy of this message | ||
ID: 18670
Updated by: rasmus@php.net
Reported By: nic@bbmcarlson.com
-Status: Verified
+Status: Analyzed
Bug Type: Date/time related
Operating System: RedHat Linux Linux linux1 2.2.16
PHP Version: 4.2.2
New Comment:
The problem is that it adds a full month to the current timestamp. So
you end up getting the 31st of the next month and some months do not
have 31 days. I'll need to do some reading to determine if strtotime()
is supposed to pick the beginning of the next month instead, or perhaps
the middle.
Previous Comments:
------------------------------------------------------------------------
[2002-07-31 10:38:50] nohn@php.net
Strange... With PHP4.3.0-dev-200207300000 on Compaq Tru64 the output is
"July October December".
------------------------------------------------------------------------
[2002-07-31 10:26:00] nic@bbmcarlson.com
I have some code:
$nextmonth = strtotime("next month");
$monthafter = strtotime("next month",$nextmonth") ;
$monthOne = date("F") ;
$monthTwo=date("F",$nextmonth) ;
$monthThree=date("F",$monthafter) ;
Today is July 31 2002. I have the code:
print($monthOne) ;
print($monthTwo) ;
print($monthThree) ;
It prints: July, August, October
I expect it to print: July, August, September
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18670&edit=1