Hello,
I have a requirement to count hours with 2 given timestamps , something like :
SQL> select ((to_date('22-oct-2012 13:00:00','dd-mon-yyyy hh24:mi:ss') - to_date('20-oct-2012 13:00:00','dd-mon-yyyy hh24:mi:ss'))*24) B from dual ;
B
----------
48
However, I wish it would be as simple as this. I only need to count the hours between two timestamps during working hours e.g. 8 am - 5 pm and MON-FRI (exclude weekends).
So, lets say i have to count the hours between the two dates given above the result should be 18 hours, not 48 (4 hours on 20/oct, 9 hours on 21/oct and 5 hours on 22/oct).
How can I achieve this? Any insight will be helpful.
Thanks