How to add month from current date in PHP

472 views Asked by At

Hi I'm still new in PHP and currently I want to make system about Employee Allowance and have no idea how to start calculate months in php .For example Steve should get allowance for 4 months from now and database stored the result of calculation, so far the coding is:

?php
$date=date_create("2013-03-15");
date_add($date,date_interval_create_from_date_string("40 days"));
echo date_format($date,"Y-m-d");
?>

Months input is from user and stored in database.

1

There are 1 answers

3
Bing On

I'm not sure I follow your 40 days versus 4 months, but I think you want something like this:

echo date('Y-m-d', strtotime("Now +40 days"));