Skip 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.

Rounding Time

Featured Replies

How is the best way to round time? I need to round time to the nearest 1/10 hour and the nearest 1/4 hour. Can anyone suggest a good way to do this?

Here's one way. Make a calculation field (result text) with the following calculation. This calc assumes that the field holding the actual time is named "test", and that this field is defined as a time field:

Case(

Right(Substitute(TimeToText(test), ":", ""), 4) < "0731", Left(Substitute(TimeToText(test), ":", ""), 2),

Right(Substitute(TimeToText(test), ":", ""), 4) > "0730" and Right(Substitute(TimeToText(test), ":", ""), 4) < "2231", Left(Substitute(TimeToText(test), ":", ""), 2) & ".25" ,

Right(Substitute(TimeToText(test), ":", ""), 4) > "2200" and Right(Substitute(TimeToText(test), ":", ""), 4) < "3731", Left(Substitute(TimeToText(test), ":", ""), 2) & ".5" ,

Right(Substitute(TimeToText(test), ":", ""), 4) > "3730" and Right(Substitute(TimeToText(test), ":", ""), 4) < "5231", Left(Substitute(TimeToText(test), ":", ""), 2) & ".75" ,

Left(Substitute(TimeToText(test), ":", ""), 2) + 1)

This is just for the neast 1/4 situation. You can extend the logic and make another calc field for the tenths. Note that the final default Case assumes that the time is, say, 12:52:30 or greater, so it will take the hour and add one, rounding it to 13. As the result is text, you can add a & ".00" to make it 13.00 if needed.

If you need the result to be a number for further calculation. Imbed the whole thing into a TextToNum function.

Hopefully, someone else will come up with a more elegant solution!

Steve Brown

Bearing in mind that time is stored as the number of seconds past midnight, you can use this info along with the Round function. 1/10th of an hour is 360 seconds, and 1/4th of an hour is 900 seconds.

NearestQuarter = Round(Time/900,0)*900

NearestTenth = Round(Time/360,0)*360

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.