Edit report at http://bugs.php.net/bug.php?id=26565&edit=1
ID: 26565
Comment by: fortizma at gmail dot com
Reported by: michaelw at darkhorse dot com
Summary: strtotime('this month') resolving to the wrong
month?
Status: Closed
Type: Bug
Package: Date/time related
Operating System: Mac OS X 10.2.x
PHP Version: 4.3.4
Assigned To: derick
Block user comment: N
Private report: N
New Comment:
Derik, thanks for your reply, but in my last reply, I'm talking about
last month,
no next month.
Thanks in advance.
Previous Comments:
------------------------------------------------------------------------
[2011-03-30 19:48:40] [email protected]
http://derickrethans.nl/obtaining-the-next-month-in-php.html
------------------------------------------------------------------------
[2011-03-30 19:45:35] fortizma at gmail dot com
Based on the current date which is march 30, 2011.
if I try echo date('Y-m-d', strtotime('-1 months')); I would expect
2011-02-28,
but what I'm getting is 2011-03-02.
Do this occur due to 2011 is not a leap year?
------------------------------------------------------------------------
[2003-12-10 09:06:48] [email protected]
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2003-12-10 05:57:44] [email protected]
More to the point, "next" is specifically equated to "2" (or "+2") in
the documentation referenced by the strtotime() manual page, so your
expectation for "next month" is simply wrong.
However, "this" is also specifically equated to a "zero-valued
displacement ... preferred in date strings like `this thursday'" (which
doesn't sound very "fuzzy" to me), so the behaviour of "this month" in
your example is, at the least, questionable. On this basis, I'm
re-opening this bug (with a revised summary) so a developer who knows
their way round strtotime() can take another look.
------------------------------------------------------------------------
[2003-12-09 14:37:06] [email protected]
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)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=26565
--
Edit this bug report at http://bugs.php.net/bug.php?id=26565&edit=1