morgi morgi - 2 months ago 7x
PHP Question

Current date + 2 months

I wrote this piece of code in order to display the current date + 2 months :

$date = date("d/m/Y");
$date = strtotime(date("d/m/Y", strtotime($date)) . "+2 months");
$date = date("d/m/Y",$date);
echo $date;

It does not seem to work as it displays : 01/03/1970.

What am I doing wrong?

Thanks for your help.


After reading comments and answers, I simplified and corrected it.

$date = date("d/m/Y", strtotime(" +2 months"));
echo $date;


You're missing the second argument for the second strtotime() call:

echo date('d/m/Y', strtotime('+2 months'));