QuarterHour ( theTime )
Converts time to the quarter hour
Average rating: 4.4 (28 votes) Log in to vote
Jim Mitchell - Show more from this author
https://jimmitchell.org |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Calculates the quarter-hour equivalents of hourly time for payroll type uses.
Works great as an Auto-Enter Calculation (replacing the contents) when using time fields
Comments
Kyle Williams, Augusto Digital Aug 10, 2020 |
||
Here is another variant that might calculate a little faster.. I imagine using the mod function could help simplify this function even more.. Let([ tm = theTime ;n = GetAsNumber(tm) ;sec = tm/3600 ;Ttm = Truncate((tm/3600); 0) ;hr = Hour(tm) ]; Case( n > 0 and sec - Ttm >= 0 and sec - Ttm < .13; GetAsTime(hr & ":00"); n > 0 and sec - Ttm >= .13 and sec - Ttm < .38; GetAsTime(hr & ":15"); n > 0 and sec - Ttm >= .38 and sec - Ttm < .63; GetAsTime(hr & ":30"); n > 0 and sec - Ttm >= .63 and sec - Ttm < .88; GetAsTime(hr & ":45"); n > 0 and sec - Ttm >= .88 and sec - Ttm < 1; GetAsTime(hr + 1 & ":00") )) |
||
Paul, Peak 14 LLC Feb 25, 2022 |
||
Was looking for this online and decided to make it with Mod(). You can do this with a 1 liner: theTime - Mod ( theTime; 3600 ) + Round ( Mod ( theTime; 3600 ) / 900; 0 ) * 900 It's quite simple though and doesn't do any error trapping. I made this into a Custom Function that does that and lets you define what you want to round it to: https://www.briandunning.com/cf/2579 |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.