Ocean West Posted October 18, 2002 Posted October 18, 2002 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
Vaughan Posted October 18, 2002 Posted October 18, 2002 Hmmm this is harder than it looks! Let me have a play....
Vaughan Posted October 18, 2002 Posted October 18, 2002 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
Vaughan Posted October 18, 2002 Posted October 18, 2002 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 ) --
kennedy Posted October 18, 2002 Posted October 18, 2002 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.
BobWeaver Posted October 18, 2002 Posted October 18, 2002 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
RussBaker Posted October 21, 2002 Posted October 21, 2002 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.
Recommended Posts
This topic is 8069 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now