Expected Result
Rounding time : 15 minutes
This time is 10:00 => Rounded until: 10:00
This time is 10:13 => Rounded up: 10:15
This time is 10:15 => Rounded up: 10:15
This time is 10:16 => Rounded up: 10:30
This time is 4:00 p.m. => Rounded up to: 4:00 p.m.
This time is 16:12 => Rounded up: 16:15
Rounding time depends on user input
Mycode
var m = (((minutes + 7.5)/roundOffTime | 0) * roundOffTime) % 60;
var h = ((((minutes/105) + .5) | 0) + hours) % 24;
Current output
This time: 08:22 => Rounded up: 08:15
This time: 08:23 => Rounded until: 08:30
The required rounding time should be in increasing order
source
share