Forum Discussion
QuickBaseCoachD
8 years agoQrew Captain
Try this
var duration RoundedDurationFromMidnight =
Round([My Time Of Day Field] - ToTimeOfDay("12:00 am"), Minutes(15));
ToTimeOfDay("12:00 am") + $RoundedDurationFromMidnight
I had a look and the Round function will round durations, but not a TimeOfDay field.
So, my cheat is to change the time of day into the duration from Midnight, and round that Duration. But now we have a duration and we need a TimeOfDay. So then I add that Duration to midnight, to get back to the Time Of Day rounded.
var duration RoundedDurationFromMidnight =
Round([My Time Of Day Field] - ToTimeOfDay("12:00 am"), Minutes(15));
ToTimeOfDay("12:00 am") + $RoundedDurationFromMidnight
I had a look and the Round function will round durations, but not a TimeOfDay field.
So, my cheat is to change the time of day into the duration from Midnight, and round that Duration. But now we have a duration and we need a TimeOfDay. So then I add that Duration to midnight, to get back to the Time Of Day rounded.
- JustinPauga8 years agoQrew CadetAwesome, this worked great!
In case anyone runs into this issue as well, if the [My Time Of Day Field] is a date/time like mine is then you have to use the ToTimeOfDay function on that as well so your formula would look like:
var duration RoundedDurationFromMidnight =
Round(_ToTimeOfDay([My Time Of Day Field]_) - ToTimeOfDay("12:00 am"), Minutes(15));
ToTimeOfDay("12:00 am") + $RoundedDurationFromMidnight