Print time in 15-minute increments between two times in the same day

it can also be done with the range function

<?php
date_default_timezone_set("Europe/London");
$range=range(strtotime("08:00"),strtotime("17:00"),15*60);
foreach($range as $time){
        echo date("H:i",$time)."\n";
}
?>

so you don’t have a loop, it just makes an array for you (my loop is just to print it out whilst formatting it)

Leave a Comment

tech