Link to home
Start Free TrialLog in
Avatar of cpasula
cpasula

asked on

Round time to the closest half hour -access 2000

I have an attendance database and I need to round 'OUT" time to the closest hour. And then calculate overtime based on the 'End Time' (the time an employee should officially leave) and the OUT time (rounded):

Example:
Time Out   Round time  
 
4:10            4:00
4:55            5:00
4:25            4:30  

This is the formula I have in my query to calculate the overtime:

 DateDiff("n",[End Time],[OUT])/60,0) AS OT

Avatar of Flyster
Flyster
Flag of United States of America image

Will this work gor you?

Round Time: IIf(Minute([Time Out])<15,TimeSerial(Hour([Time Out]),0,0),IIf(Minute([Time Out])<45,TimeSerial(Hour([Time Out]),30,0),TimeSerial(Hour([Time Out])+1,0,0)))

Flyster
Avatar of cpasula
cpasula

ASKER

fLYSTER

Your formula is working perfect to round the time. But how can I do it so my overtime 'OT' (overtime)  is also rounded. This is the formula I currently have:

DateDiff("n",[End Time],[OUT])/60,0) AS OT

ASKER CERTIFIED SOLUTION
Avatar of Flyster
Flyster
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial