ive been given a large list of entries from a database which essentially give me 3 dates... (its a db to log issues)

date 1 - issue raised
date 2 - issue passed to my department
date 3 - completed date

so to find out how long we have the issue would be date 3 - date 1 and to figure how long our department spends on an issue would be date 3 - date 2

this is where the issue comes in...
the SLA the department agrees to says that a percentage needs to take less than 3 working days.

They define a working day from 6am to 6pm excluding weekends. So how can I go about setting up a column which does:

(Date 3 - date 1) - (time counted from 6pm to 6am + weekends if necessary)

I currently have this set up,
Date 3 - date 1 = Value
round this value to the nearest whole number (if this is 0, it wasnt left over night... if it is 1 it was left 1 night, 2 2nights and so on)
(date 3 - date 1) - (0.5 x value) because 0.5 is the time (in days) 6pm to 6am is.
however this doesnt detect whether or not a weekend was involved (to shorten the list i can remove all values below 2.5 days as a weekend IS 2.5 days... if it didnt take 2.5 days then it must not have included a weekend)

Thanks for any help because i am honestly stuck on even where to go with this one =(