RoundTime ( time ; duration ; up )
Rounds a time to a given duration, up or down.
Average rating: 4.3 (33 votes) Log in to vote
Kieren MacMillan kierencom http://www.kierencom.ca |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
This function rounds a given time to a given duration, taking advantage of the fact that FMP stores times as an integer number (seconds). [Note: Though not strictly necessary, it is likely that the desired calculation result would be of type time.]
The 'up' parameter, which dictates rounding direction, should be either 1/true (up) or 0/false (down).
Comments
BBHH, Hamburg Dec 22, 2012 |
||
if you want to round up to 5 Minutes : RoundTime ( time ; 300 ; 1 ) and time is 00:05:00 you will get 10 minutes. I think the right time should be 5 Minutes. The improved formula is: ( Int ( (time-up) / duration ) + up ) * duration |
||
BBHH, Hamburg Dec 22, 2012 |
||
if you want to round up to 5 Minutes : RoundTime ( time ; 300 ; 1 ) and time is 00:05:00 you will get 10 minutes. I think the right time should be 5 Minutes. UPDATE: And to get 0 Minutes for the time "00:00:00" The improved formula is: If (t_time = 0;0; ( Int ( (time-up) / duration ) + up ) * duration) |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.