Forum Moderators: coopster

Message Too Old, No Replies

is there a way to increment date("F")?

         

bomburmusicmallet

5:37 pm on Mar 16, 2006 (gmt 0)

10+ Year Member



Hi all, I have a php script that processes three months at a time. I want to build an array like:

$monthAR = array('December, January, February','March, April, May','June, July, August','September, October, November');

However, I want the first three months to be the three that include the current month. What I'd really like to do is something like this:

$monthAR = array(date("F").', '.(date("F")+1).', '.(date("F")+2) etc.

But that doesn't work.

Does anyone know of a way to increment date("F")?

Thanks.

DrDoc

5:52 pm on Mar 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You would have to use a combination of mktime() [php.net] and the second (optional) argument to date() [php.net].

To get next month:
date("F", mktime(0, 0, 0, date("m")+1, date("d"), date("Y")))

bomburmusicmallet

6:00 pm on Mar 16, 2006 (gmt 0)

10+ Year Member



That's exactly what I need! Thank you!