I wrote this piece of code in order to display the current date + 2 months :
<?php
$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.
EDIT :
After reading comments and answers, I simplified and corrected it.
<?php
$date = date("d/m/Y", strtotime(" +2 months"));
echo $date;
?>
+2
. And maybe use two variables - using the same variable name over and over for different types of data is confusing and bad practice. – Crabber