Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datediff & CASE question 1

Status
Not open for further replies.

Michael091170

Technical User
Jan 7, 2005
14
GB
I need to run a query on my database that measures the difference between two datetime values. Submitted and Resolved.

This is reasonably simple enough with a datediff function. The problem comes as have I factor in core working hours and week days.

Our core hours are Monday - Friday 9:00 - 17:00 so for example:

If a call is logged at 16:45 on Friday and resolved on 09:10 the following Monday the real time to resolution is 25mins. Datediff however includes the weekend and non core hours.

How would you apply these conditions in an expression.

If anyone's done something similar before I'd be interested to find out how you achieved it.

Thanks

 
Michael - take a look at this thread, for getting weekdays between two dates.

If you can identify the weekdays in between, then you can just count each of them as 8 hours. Then add the difference between start time and office closing time on the first day, and difference between office opening time and completion time on the last day.

Am I making sense?

Hope this gets you started, post back with any specific questions.

Alex

Ignorance of certain subjects is a great part of wisdom
 
[blush]

thread183-1358690

Ignorance of certain subjects is a great part of wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top