Check whether a date range includes weekends?

Soldato
Joined
31 May 2006
Posts
4,239
Location
127.0.0.1
Hi all

Doing some classic ASP and would like to find out if a date range:

a) Includes any weekends
b) If true return how many weekend days

Thanks for any help!
 
I managed to sort it. Here is the code if anyone is interested:

Code:
myEndDate = "01/02/2010"
myVarDate = "01/01/2010" ' Start Date

do until myVarDate > myEndDate
	if Weekday(myVarDate) = "7" OR Weekday(myVarDate) = "1" then myWeekends = myWeekends + 1
	myVarDate = dateadd("d",1,myVarDate)
loop

response.write "<br>Number of weekend days: " & myWeekends & "<br>"
 
Back
Top Bottom