Rounding Times

G

Guest

How would I round the time to let's say, the nearest quarter of an hour. The
value goes down to the second, so at 7 minutes 30 seconds the time would
round up. Example: 7:52:30 AM = 8:00AM or 7:52:29 = 7:45 AM and so on.
This is in Access 97.
 
S

Sergey Poberezovskiy

I do not have '97 version handy, but I'm sure this should
work:

Date+Round((Now-Date)*96 + 0.5, 0)/96

The basic idea is that time is represented as a fraction
and all you have to do is get the number of intervals you
are after in a day:
hours - 24
halves - 48
quarters - 96

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top