Jump to content

Archived

This topic is now archived and is closed to further replies.

jon_17

Adding 1 month to date

Recommended Posts

Hi all,

I want to add 1 month to the current date and echo the result in this format: YYYYmmdd

How do I do that and still maintain the validity of the date (i.e if current date is 2006 12 25, then adding 1 month will give me 2007 01 25 not 2006 13 25)

Thank you,

Share this post


Link to post
Share on other sites
Almost straight from the manual.

[code=php:0]
$nextmnth  = date("Y m d", mktime(0, 0, 0, date("m")+1  , date("d"), date("Y")));
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.