Rounding time to nearest quarter, atleast 30 minutes in time
Bah, I've been fiddling on how to do this. I need a function that returns <hour>:<minutes>
that is rounded to a quarter, but need to be atleast 30 minutes in future time.
Anyone got a go开发者_运维问答od idea and how to do this?
Add 30 minutes.
Extract date + hour on the one hand side, minutes on the other.
Divide minutes by 15, ceil the result, multiply by 15.
Build new date using date + hour and add the new minutes.
$current = date("Hi");
$ceilUp = ceil($current / 15);
$timeNeeded = $ceilUp + 30;
something like that? (I see it's not exactly what you need.. but this is a start).
精彩评论