|
-
Oct 2nd, 2002, 06:10 PM
#1
Thread Starter
Frenzied Member
Calculate number of work days?
I need to be able to calculate the number of work days (no weekends) between to dates. How can I do this in ASP?
-
Oct 3rd, 2002, 01:24 AM
#2
Member
Explain again and Give me ur todates
-
Oct 3rd, 2002, 07:14 AM
#3
Addicted Member
Do you need to account for national holidays and such as well?
--------------------------
Joon Lee
-
Oct 3rd, 2002, 10:17 AM
#4
Frenzied Member
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
I'm off to GalahTech, hope to see you there.
If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|