I'm looking for a function to calculate the number of work days; Monday - Friday, between two dates. I have an application that must do tons of these calculations so speed is quite important. ie - no looping through the date range to count the work days. My initial thoughts are:
get the number of days between the dates (nworkdays)
determine the start and end DOW
reduce nworkdays by work days left in start week
reduce nworkdays by number of days into end week
determine number of weeks in remaining days to get weekend days (nworkdays/7)*2
subtract weekend days from original nworkdays
Any thoughts on better approaches?
Better yet, anyone got such a function already written they would like to share.
TIA
Michael McLain