Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculating work days
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Calculating work days
Miscellaneous
Thread ID:
00338999
Message ID:
00338999
Views:
57
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
Next
Reply
Map
View

Click here to load this message in the networking platform