Forum Moderators: coopster

Message Too Old, No Replies

Adding 1 Month to Unix Timestamp

How to add 1 Month onto a Unix Timestamp created by strtotime()

         

apacheMan

4:29 pm on May 9, 2008 (gmt 0)

10+ Year Member



Hey gang,

I'm trying to figure out how I can add 1-Month on to a "2008-05-09" style date. But I am converting that date to a Unix Timestamp first by doing the following:

$capturedDate = '2008-06-20';
$endDate = strtotime($capturedDate);

// Now I need to add 1 Month onto $endDate.

Anyone know how I can add 1-month onto $endDate using PHP? I've been looking high and low in the PHP manual under date/time functions, but can't find anything that will do it with a unix timestamp. Thanks for any help.

cameraman

4:34 pm on May 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use strtotime again
$endDate = strtotime('+1 month',$endDate);