MySQL : Calculate business day difference between two dates column
- by yokoyoko
My sql query returns back two columns, first column is "date created" and second column is "date updated", first column has a prior timestamp with respect to second column.
I need to add a third column which can display business day hrs (9:00am to 5:00pm) response i.e. if date created is 2012-01-01 09:00:20 and "dated updated" is 4:00pm same day then third column should display 7 hrs
If date created is 2012-01-01 16:00:20 (4:00pm) and "date updated" is 10:00m on 2012:01:02 (2nd Jan) then third column should display 2 hrs.
It should exclude Saturday and Sunday.
Can you please suggest appropriate SQL query for this.