I need a way to round to the closest quarter hour.
Given time: 08:22 AM => Rounded to: 08:15 AM
Given time: 08:23 AM => Rounded to: 08:30 AM
I have this function to find the current time:
$scope.clock = "loading clock..."; // initialise the time variable
$scope.tickInterval = 1000 //ms
var tick = function () {
$scope.clock = Date.now() // get the current time
$timeout(tick, $scope.tickInterval); // reset the timer
}
// Start the timer
$timeout(tick, $scope.tickInterval);
I then need to round my clock to the nearest quarter hour.