Determine the number of weekdays or weekends that fall within a given range of dates. This computation calculates the number of weekends that fall within a given range of dates. Note that both the start date and the end date are included in the count.
Odd days are days short of one week.
Next we add this number to the DAY OF WEEK value. So we count two weekend days. The computation also checks for a couple of exceptions which are difficult to explain. See if you can figure them out for yourself some afternoon. We store our total at this point in the temporary number variable nTemp .