PHP date add 5 year to current date

后端 未结 10 2081
野的像风
野的像风 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条回答
  •  猫巷女王i
    2020-12-01 03:47

    try this ,

    $presentyear = '2013-08-16 12:00:00';
    
    $nextyear  = date("M d,Y",mktime(0, 0, 0, date("m",strtotime($presentyear )),   date("d",strtotime($presentyear )),   date("Y",strtotime($presentyear ))+5));
    
    echo $nextyear;
    

提交回复
热议问题