Number of working Days (Mon-Fri) between two dates?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 10 of 13

Thread: Number of working Days (Mon-Fri) between two dates?

Threaded View

  1. #1
    Join Date
    Jan 2000
    Location
    Chester, England.
    Posts
    818

    Number of working Days (Mon-Fri) between two dates?

    Has anyone there written - or know of - a query or function to return the number of working days between two dates?

    My pseudo code would be a function accepting the two dates and returning a number of working days. Anyone have anything quicker/more elegant/ simpler?



    IN (start_date, end_date) OUT (Num_days)
    --
    total_days := (end_date - start_date);
    --
    count := 1;
    --
    LOOP UNTIL start_date = end_date
    IF TO_CHAR(start_date,'Dy') IN ('Sat','Sun')
    Then add 1 to count
    start_date := start_date + 1
    END LOOP
    num_days := (total_days - count)
    --
    RETURN num_days
    --
    Last edited by JMac; 02-03-2004 at 01:29 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width