Re: strtotime bug? end of the month.
| From: | 1LT John W. Holmes | Date: | Thu, 31 Oct 2002 17:09:52 +0000 |
| Subject: | Re: strtotime bug? end of the month. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122280@lists.php.net to get a copy of this message | ||
> date("Y-m-d",strtotime("+1 month"))
>
> returns December 1st! This happens when you add 1 month to any day that
> doesn't exist in the next month. Quite annoying that you have to handle
> it like this:
>
> date("Y-m-d",strtotime("+1 month",strtotime(date("Y-m-1"))))
How about
echo date('y-m-d',strtotime('next month last day'));
---John Holmes...