Solved

Round time to the closest half hour -access 2000

Posted on 2008-06-19
3
397 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

749 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