Return to Snippet

Revision: 10619
at January 6, 2009 11:52 by joeymarchy


Updated Code
$date = date("Y-m-d");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +12 month");
$date = date("Y-m-d",$date);
echo $date;

Other examples
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 day");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 week");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +2 week");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 month");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +30 days");

Revision: 10618
at January 6, 2009 11:52 by joeymarchy


Initial Code
$date = date("Y-m-d");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +12 month");
$date = date("Y-m-d",$date);
echo $date;

Initial URL

                                

Initial Description

                                

Initial Title
Add months, days, years to PHP date()

Initial Tags
date

Initial Language
PHP