incrementing time 15 minutes within loop

后端 未结 2 1493
故里飘歌
故里飘歌 2021-01-26 13:21

I want to create a dropdown that will take current time as start time and will end up till 24 hours, like till coming 24 hours so in between it will show time of every 15 minute

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-26 13:57

    there are a couple of things. First on your first line you are missing the second parameter. Then you are using $tNow undefined.

    $current_time = date('h:i A', time());
    $end_hour     = date("+24 hours", strtotime($current_time));
    
    
    $tNow = strtotime($current_time);
    echo "";  
    for($i = 0; $i <= 96; $i++) {
        echo "";
        $tNow = strtotime('+15 minutes', $tNow);
    }
    

提交回复
热议问题