PHP round time() up (future) to next multiple of 5 minutes
$now = time();
$next_five = ceil($now/300)*300;
This will give you the next round five minutes (always greater or equal the current time).
I think that this is what you need, based on your description.
Try:
$time = round(time() / 300) * 300;
Try this function:
function blockMinutesRound($hour, $minutes = '5', $format = "H:i") {
$seconds = strtotime($hour);
$rounded = round($seconds / ($minutes * 60)) * ($minutes * 60);
return date($format, $rounded);
}
//call
blockMinutesRound('20:11');// return 20:10