Unanswered: days and hours between 2 dates (minus weekends)
I have a query that will give me the number of business days (taking away saturdays and sundays) between 2 dates... I need to extend this to give me the number of hours also (or fraction of a day) for more accuracy, can anyone help?
The SQL I currently have is...
FROM (SELECT rownum my_row, TO_DATE ('&&from_date', 'dd/mm/yyyy hh:mi:ss') + LEVEL - 1 mydate
CONNECT BY LEVEL < =
TO_DATE ('&&to_date', 'dd/mm/yyyy hh:mi:ss')
- TO_DATE ('&&from_date', 'dd/mm/yyyy hh:mi:ss')
WHERE TO_CHAR (mydate, 'DY') NOT IN ('SAT', 'SUN')
Any help on how to include hours also would be great!!
I'm afraid I didn't quite understand the problem, but nevertheless: now you have days and want to have hours? As one day has 24 hours, I'd multiply [number of days * 24]. But it can't be that simple, can it?