Re: date, "first of next month"?
| From: | Philip Hallstrom | Date: | Thu, 27 Feb 2003 00:13:08 +0000 |
| Subject: | Re: date, "first of next month"? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137323@lists.php.net to get a copy of this message | ||
> On Wed, 26 Feb 2003, 1LT John W. Holmes wrote:
>
> |You would think strtotime("first of next month") would work, but it doesn't.
> |This does:
> |
> |$t = mktime(0,0,0,date('m')+1,1,date('Y'));
> |
> |Gives you timestamp of first day, next month. Format accordingly with
> |date().
>
> Thats great, worked perfectly! Thank you very much :)
>
> Heres a tough one, is there such a say to now get the date of the first
> weekday after that date?
Use the w option of date() and loop through adding 86400 to $t until you
get to a number between 1 and 5.
w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
-philip