PHP date add 5 year to current date

后端 未结 10 2087
野的像风
野的像风 2020-12-01 03:47

I have this PHP code:

$end=date(\'Y-m-d\');

I use it to get the current date, and I need the date 5 years in the future, something like:

10条回答
  •  难免孤独
    2020-12-01 04:09

    To add one year to todays date use the following:

    $oneYearOn = date('Y-m-d',strtotime(date("Y-m-d", mktime()) . " + 365 day"));
    

提交回复
热议问题