#26565 [Opn->Bgs]: strtotime('next month') resolving to the wrong month

From: Date: Tue, 09 Dec 2003 19:37:08 +0000
Subject: #26565 [Opn->Bgs]: strtotime('next month') resolving to the wrong month
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-51853@lists.php.net to get a copy of this message
ID: 26565 Updated by: sniper@php.net Reported By: michaelw at darkhorse dot com -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Mac OS X 10.2.x PHP Version: 4.3.4 New Comment: Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Thank you for your interest in PHP. And this is expected behaviour. (this, next, etc. are FUZZY, rtfm) Previous Comments: ------------------------------------------------------------------------ [2003-12-09 13:09:41] michaelw at darkhorse dot com Description: ------------ strtotime adds an extra month when using the phrase "this month" or "next month". Using '+1 months' or '+0 months' works fine, though. And, no, I'm not adding a month to 'Jan. 30'. Reproduce code: --------------- echo date('Y-m-d', strtotime('last month')); echo date('Y-m-d', strtotime('this month')); echo date('Y-m-d', strtotime('next month')); echo date('Y-m-d', strtotime('-1 months')); echo date('Y-m-d', strtotime('+0 months')); echo date('Y-m-d', strtotime('+1 months')); Expected result: ---------------- 2003-11-09 2003-12-09 2004-01-09 2003-11-09 2003-12-09 2004-01-09 Actual result: -------------- 2003-11-09 2004-01-09 2004-02-09 2003-11-09 2003-12-09 2004-01-09 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26565&edit=1

« previous php.bugs (#51853) next »