October 18, 200223 yr I am trying to figure out the calc that would round a time field to the nearest quarter hour. IE: 10:00 thru 10:14 = 10:00 or 7:45 thru 7:59 = 7:45
October 18, 200223 yr OK, take a look at the attached FMP 5/5.5/6.0 file... it looks at the minutes, rounds them down to the nearest quarter hour, then converts it back to time again. time round.fp5.zip
October 18, 200223 yr Heck, don't bother with the attachment. Here is an even simpler and more elegant version of the calculation: -- Time( Hour(time), Case(Minute(time) >= 0 and Minute(time) <= 14, 0, Minute(time) >= 15 and Minute(time) <= 29, 15, Minute(time) >= 30 and Minute(time) <= 44, 30, Minute(time) >= 45 and Minute(time) <= 59, 45), 0 ) --
October 18, 200223 yr Or even shorter... Time(Hour(time), 15 * Int(Minutes(time) / 15)) You can use that to round down to 10's or 30's or whatever... just change the two numbers.
October 18, 200223 yr Even simpler: Round(time/900, 0)*900 if you want to round up or down, or if you want to round down only: Int(time/900)*900
October 21, 200223 yr If you look at the Handy Bits file (RussCalcs from Oz.fp5) in the samples section of the forum, there is an option in the time tab which will round hours to a selected fraction. So, the user can select time to be rounded either up or down to the nearest o.xx of an hour.
Create an account or sign in to comment