I'm currently trying to recreate a manual report which creates an "Aging" column for and Activity but excludes non-working hours from the calculation. Is this possible to create, and how would I go about it in T-SQL (SSMS 2014 or using and odbc connection to the db2), I have a moderate level of experience but cannot find any information on these sorts of calculations. Example :
Datetime1 = '2015-01-30 21:30:00.000'
Datetime2 = '2015-02-02 06:30:00.000'
DATEDIFF = 57 hours
However I would need the calculation to exclude any time after 22:00 or before 06:00 and weekends, so the "Aging" would read as 1 Hour.
I really hope you can help!!