Solved

Round time to the closest half hour -access 2000

Posted on 2008-06-19
3
395 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
ID: 21826774
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
ID: 21826872
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
ID: 21826944
Can't you use Round Time instead of OUT?

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

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

919 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

17 Experts available now in Live!

Get 1:1 Help Now