Edit report at http://bugs.php.net/bug.php?id=33013&edit=1

 ID:                 33013
 Comment by:         luket at ukvoipnet dot com
 Reported by:        nick at netdupe dot com
 Summary:            strtotime - 'next month' doesn't work.
 Status:             Closed
 Type:               Bug
 Package:            Date/time related
 Operating System:   Mac OS X 10.4
 PHP Version:        5.0.4
 Block user comment: N

 New Comment:

If you are trying to get the month & year of next/previous month try
uisng the following function: mktime(0, 0, 0, date("m")+1, 1,
date("Y")); using date("m")+1, +2, -1 etc.. as needed. 



You can then place this into a date function as the unix timestamp
argument.


Previous Comments:
------------------------------------------------------------------------
[2005-05-20 13:15:47] der...@php.net

As we can't remove it because of BC, "next" will now means "1" from now
on. "second" will not work in PHP 4.3 (unless I port back my date time
stuff) and in PHP 5.0 it won't work at all. PHP 5.1 will support "second
second" (+2 seconds) and the like.

------------------------------------------------------------------------
[2005-05-20 08:05:53] ras...@php.net

I don't think not having a "second" means that "next" should take its
place when it doesn't match the common usage of the word.  The whole
point of having these terms at all is to make it easier to use.  If we
are going to go to the trouble of making "next month" work, then it
should work the way people expect.  Otherwise we should get rid of these
terms completely and just go with the more explicit "+1 month" syntax
instead.

------------------------------------------------------------------------
[2005-05-19 21:04:12] der...@php.net

Actually, the new parser that I wrote can handle this just fine... so,
shall we make next 2 or 1 (in PHP 5.1)?

------------------------------------------------------------------------
[2005-05-19 21:01:04] der...@php.net

I also know the rationale - without "next" linking to 2, there would be
no way to represent "2" as "second" already means something else (the
time unit). So I think we should not change it back to "1".

------------------------------------------------------------------------
[2005-05-16 13:45:56] m...@php.net

The change was due to bug report http://bugs.php.net/bug.php?id=18655.



It looks like the GNU spec has changed, since at that time we all agreed
it said "next" was equivalent to 2 -- I even quoted the relevant section
in my contribution to the discussion.  It's more intuitive if "next" is
equivalent to 1, so I guess it would be reasonable to change back, just
as long as the various changes are sufficiently documented! ;)

------------------------------------------------------------------------


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=33013


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=33013&edit=1

Reply via email to