Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Round Time...

Featured Replies

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

Hmmm this is harder than it looks! Let me have a play....

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

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 )

--

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.

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

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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.