24 hour time problem

Headworth

New member
Local time
Today, 02:21
Joined
Aug 5, 2010
Messages
4
Hi all

I am trying to do a query to find the hours worked by an employee
when i run my query if the hour are 6.30AM to 18.30PM I get 12 hours this is ok. But when put 18.30PM to 6.30AM I get -12 hours

Please can you help

Regards
Headworth
 
it makes sence doesnt it?basicaly you shouldnt compare times without their respective date components.
2010-08-01 18.30
2010-08-02 06:30
If you use those you will be goood..... however if your 'stuck' working with time only something like this will work:
StartTime - EndTime + IIF(EndTime < Starttime,1,0)
 
Hi Namliam

Thank you for your help
Tried your code but code gives me -11 hours

Regards
Headworth
 
What is the formula your using?
would the ABS function be what your looking for?
 
This is my formula ([EmpEndTime]-[EmpStartTime])*24
I will try the abs function?
 
This works for me. I got it from another topic here on the board...

Hours: IIf(((([endtime]-[starttime])*1440)<0),((([endtime]-[starttime])*1440)+1440),(([endtime]-[starttime])*1440))/60

Works fine on 24-hr military time
 

Users who are viewing this thread

Back
Top Bottom