Question Calculating business days End Date

gdshih

Member
Joined
Jun 22, 2012
Messages
7
Programming Experience
Beginner
I need to calculate the end date given the number of business days (excluding weekend and holidays). All the examples I've seen so far return the number of business days between a start date and an end date.

Any help would be appreciated.

Thanks
 
The basic algorithm for business day calculators is

Define start and end dates
Business Days = end-start
For date = start to end
If date is weekend or holiday then Business Days=Business Days-1
Next

All you need to do is turn this on its head

Date=Start Date
Difference = Business Days
While n<business days
n=n+1
Date=date+1
If date is weekend or holiday then Difference= Difference + 1 AND n=n-1
Loop
End Date=Start Date + Difference
 
Back
Top