Is there a simple way of getting the current time and rounding it up to the next quarter of an hour?
For example if it is 12:36 then display 12:45 if it's 13:01 then display 13:15
etc
here is your answer
$current_date = date('d-M-Y g:i:s A');
echo $current_date."<br/>";
$current_time = strtotime($current_date);
$frac = 900;
$r = $current_time % $frac;
$new_time = $current_time + ($frac-$r);
$new_date = date('d-M-Y g:i:s A', $new_time);
echo $new_date."<br/>";
LIVE DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With