Solved

Round time to the closest half hour -access 2000

Posted on 2008-06-19
3
394 Views
Last Modified: 2008-06-19
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

0
Comment
Question by:cpasula
  • 2
3 Comments
 
LVL 22

Expert Comment

by:Flyster
Comment Utility
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
0
 

Author Comment

by:cpasula
Comment Utility
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

0
 
LVL 22

Accepted Solution

by:
Flyster earned 125 total points
Comment Utility
Can't you use Round Time instead of OUT?

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now