Time Spent Calculation

Time Spent Calculation

I'm using MSSQL as my platform.

I would like to know how to calculate my own time spent between 2 dates.  Clearly SDP does this for me in the WO_Group_Info, WO_Tech_Info, and WO_Status_Info tables, but this is NOT what I'm looking for.  I would like to know the underlying code that does the math and logic.  I would imagine that something within the system if factoring in HoursOfOperation, DaysOfOperation, HolidayDefinition, Hold_Period_Group and/or Hold_Period_Tech.  I've looked through the functions that exist in the servicedesk database and I don't see anything related to time.

Ultimately, I'd like to create a function that can return TimeSpent based on two timestamps of my choosing.  That way, I can figure out how much "business time" passed between when a ticket was assigned to a group and when the ticket violated SLA.
For example, if a ticket was assigned to my group at 4:57pm (hoursofoperation endtime is 17:00:00) and then the ticket violated SLA the following morning at 9:00am (hoursofoperation starttime is 07:30:00), I would like the ability to see 1 hour 33 minutes.

That's just one example.  Sometimes a weekend might be involved.  Sometimes a holiday.  I need the ability to plug in a starting timestamp and an ending timestamp and get a timespent result that may have nothing to do with Tech, Group, or Status.

                  New to ADSelfService Plus?