Guest Posted May 23, 2007 Share Posted May 23, 2007 I don't know exactly how to do this I have came across some code but dont know that it works this way. I want to take todays date and add one month to it. But I don't know if I can just add 30 days what if its only 28 days in the next month will the date automatically add on month? How can I add a month exactly one month? Link to comment https://forums.phpfreaks.com/topic/52644-solved-date-plus-month/ Share on other sites More sharing options...
AndyB Posted May 23, 2007 Share Posted May 23, 2007 Solutions here: http://ca3.php.net/manual/en/function.strtotime.php http://ca3.php.net/manual/en/function.mktime.php Link to comment https://forums.phpfreaks.com/topic/52644-solved-date-plus-month/#findComment-259857 Share on other sites More sharing options...
taith Posted May 23, 2007 Share Posted May 23, 2007 agreed... you strtotime() today's date... aka "now" which gives you the unix timestamp, then mktime() it +1 month :-) then date() it back to readable time :-) Link to comment https://forums.phpfreaks.com/topic/52644-solved-date-plus-month/#findComment-259860 Share on other sites More sharing options...
kenrbnsn Posted May 23, 2007 Share Posted May 23, 2007 Why involve mktime()? I would just used date() & strtotime() <?php $today_plus_1_month = date('F j, Y',strtotime('+1 month')); echo $today_plus_1_month; ?> Ken Link to comment https://forums.phpfreaks.com/topic/52644-solved-date-plus-month/#findComment-259900 Share on other sites More sharing options...
Guest Posted May 23, 2007 Share Posted May 23, 2007 Thats exactly what I needed. Thank you so much Link to comment https://forums.phpfreaks.com/topic/52644-solved-date-plus-month/#findComment-259903 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.