php - Add 2 years to date -


i can't seem work out why isn't working.

i may of done wrong hoping can help.

i have date , want add 2 years date. when run code echo's date started with.

does know have gone wrong? want use date in $start_date not today's date.

$start_date = "2013-05-06 13:18:56";     $targetdate = date($start_date, strtotime('+2 years'));     echo $targetdate; 

you want this:

$new_date = date('y-m-d h:i:s', strtotime('+2 years', strtotime($from_date))); 

for options date format, check out documentation.


Comments