How can I get a date after 15 days/1 month in PHP?

Shyju picture Shyju · May 6, 2009 · Viewed 57.8k times · Source

In my PHP code I have a date in my variable "$postedDate".
Now I want to get the date after 7 days, 15 days, one month and 2 months have elapsed.

Which date function should I use?

Output date format should be in US format.

Answer

PaulJWilliams picture PaulJWilliams · May 6, 2009

Use strtotime.

$newDate = strtotime('+15 days',$date)

$newDate will now be 15 days after $date. $date is unix time.

http://uk.php.net/strtotime