Takes in a start and end date and calculates the difference between the time. Them rounds up to a specified interval (15 minutes in this example) and outputs as hours.
Takes in a start and end date and calculates the difference between the time. Them rounds up to a specified interval (15 minutes in this example) and outputs as hours.
var startTime = arguments[0]
var endTime = arguments[1]
var roundInterval = 900000 //15 minutes
var timeDiff = endTime.getTime() - startTime.getTime()
var timeIntervals = Math.ceil(timeDiff / roundInterval)
var timeDiffInHours = (roundInterval * timeIntervals) / 3600000
return timeDiffInHours