PHP: get next 13 dates from date?

后端 未结 3 1285
遇见更好的自我
遇见更好的自我 2021-01-20 15:36

I am trying to get an array of a date plus the next 13 dates to get a 14 day schedule starting from a given date.

here is my function:

$time = strtot         


        
3条回答
  •  滥情空心
    2021-01-20 15:48

    I would use strtotime

    $start = strtotime($s_row['schedule_start_date']);
    $dates=array();
    for($i = 1; $i<=14; $i++)
    {
        array_push($dates,date('Y-m-d', strtotime("+$i day", $start)));
    }
    print_r($dates);
    

提交回复
热议问题