Adding days to $Date in PHP

前端 未结 9 2115
时光取名叫无心
时光取名叫无心 2020-11-22 09:32

I have a date returned as part of a mySQL query in the form 2010-09-17

I would like to set the variables $Date2 to $Date5 as follows:

$Dat

9条回答
  •  借酒劲吻你
    2020-11-22 10:29

    Using a variable for Number of days

    $myDate = "2014-01-16";
    $nDays = 16;
    $newDate = strtotime($myDate . '+ '.$nDays.'days');
    echo new Date('d/m/Y', $soma); //format new date 
    

提交回复
热议问题