PHP date add 5 year to current date

后端 未结 10 2058
野的像风
野的像风 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 03:48

    Its very very easy with Carbon. $date = "2016-02-16"; // Or Your date $newDate = Carbon::createFromFormat('Y-m-d', $date)->addYear(1);

提交回复
热议问题