ruimc
asked on
calculate working hours in sql
Hi
I am trying to calculate working hours from a table using sql, I currently have a Startdate eg. "29/06/2006 08:29:12" and a EndDate eg. "17/07/2006 08:32:28".
The working hours are specified as 08:15 - 13:00 (Lunch) and 14:00-16:30, Monday to Friday.
Can anyone show me a way to calculate working hours using Sql or would it be best to write a program to calculate this?
Thanks
Rui
I am trying to calculate working hours from a table using sql, I currently have a Startdate eg. "29/06/2006 08:29:12" and a EndDate eg. "17/07/2006 08:32:28".
The working hours are specified as 08:15 - 13:00 (Lunch) and 14:00-16:30, Monday to Friday.
Can anyone show me a way to calculate working hours using Sql or would it be best to write a program to calculate this?
Thanks
Rui
ASKER
Hi
That sounds good...yeah please post it I'd like to check out.
Regards,
Rui
That sounds good...yeah please post it I'd like to check out.
Regards,
Rui
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent...Thanks. I have a public holiday table already setup for the sms program so it's all good.
It did indeed help and saved me plenty time. Thanks. The points are yours.
It did indeed help and saved me plenty time. Thanks. The points are yours.
I do have some SQL that calculates the working hours between 2 dates but it doesn't cater for the lunch break, however this shouldn't be hard to add in. The stored procedure also relies on a SQL function that finds out if each day is a working day. This function further relies on a table containing non-working days, like Good Friday etc. I can post it if you want. Let me know.
Regards,
Lee