I need to be able to calculate the number of work days (no weekends) between to dates. How can I do this in ASP?
Printable View
I need to be able to calculate the number of work days (no weekends) between to dates. How can I do this in ASP?
Explain again and Give me ur todates
Do you need to account for national holidays and such as well?
K, I don't know what to tell you about holidays except to code them into this but I think this is the easiest way.
VB Code:
dim datTheDate dim datYourStartDate dim datYourEndDate dim intDayCount datTheDate = datYourStartDate 'set up for the loop While datTheDate <= datYourEndDate 'for every day in range If (weekday(datTheDate) <> 1) And (weekday(datTheDate) <> 7) 'if NOT sunday or saturday intDayCount = intDayCount + 1 End If datTheDate = dateadd("d", 1, datTheDate) 'move on to the next day Wend
That sould do it :)
Michael