Time calculation problems

G

Glenn Cornish

I am trying to get a result that will show me the difference, in hours and
minutes, between two times. The application is on a staffing roster, and
what i want to be able to do is calculate working hours in the day, so
difference between start time and finish time less a predetermined amount
for lunch breaks (1/2 hour). So if someone starts at 9am and finishes at
5pm, i need the result to be 7 1/2 hours.

I have been unable to find a solution to this, so any help would be greatly
appreciated

glenn
 
A

Allen Browne

Create a query into this table.

Type a calculated field into the Field row of query design:
Hours: (DateDiff("n", [StartTime], [FinishTime]) - 30) / 60
 
J

John Vinson

I am trying to get a result that will show me the difference, in hours and
minutes, between two times. The application is on a staffing roster, and
what i want to be able to do is calculate working hours in the day, so
difference between start time and finish time less a predetermined amount
for lunch breaks (1/2 hour). So if someone starts at 9am and finishes at
5pm, i need the result to be 7 1/2 hours.

I have been unable to find a solution to this, so any help would be greatly
appreciated

Depending on the precision of the value, you can use the DateDiff()
function:

DateDiff("n", [StartTime], [FinishTime]) - 30

will give the number of minutes less lunch. Divide this expression by
60 and round to one decimal place to get hours and tenths:

Round((DateDiff("n", [StartTime], [FinishTime]) - 30) / 60., 1)
 

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