Return the Number of Business Days between Any Two Dates

Category:
Dates and Math
Type:
Snippets
Difficulty:
Intermediate
Author:
Peter Sitero

Version Compatibility: Visual Basic 5

More information:
This function takes a start date and an end date as parameters, and returns the number of business days between the two. As written, the function counts weekends, New Year's Day, Memorial Day, The Fourth of July, Labor Day, ThanksGiving, and Christmas as non-business days. However, you can easily modify the code to add more holidays, depending on your needs.

Included with the function is a demo application that makes use of it. It allows you to enter a start and end date and displays a message box with the number of business days between the two.


Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

Download workdays.zip