AshleyQuick
07-13-2004, 06:40 PM
Hi,
I would like to modify this so that the first available date that can be selected is five BUSINESS days out. The script only shows Mon-Fri so if the date is Tue Jul 13, 2004, Tue Jul 20, 2004 needs to be displayed. I've reached an impasse. :(
Ash
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<%
dateDropDown "datepicker1", 30, "DropDate"
Sub DateDropDown(name, size, default1)
'size = the number of days to display in the drop down
'default1 = default date selected in m-d-yyyy format (any non-date string is considered the current date)
'skip = if set then the program will skip Sundays and Saturdays
dim skip,today,dow,selected,option1,value,theday,mo,yr ,dd
skip = true
today = Date()
if not isdate(default1) then 'set default to current date
default1=month(today) & "-" & day(today) & "-" & year(today)
end if
response.write "<select name=" & name & " style=""font-family: monospace;"">" & vbCrLf
for i = 0 to size
theday = dateserial(Year(today),Month(today),Day(today)+i) 'automatically adjusts to correct date
dow = weekday(theday)
mo = month(theday)
yr = year(theday)
dd = day(theday)
option1 = weekdayname(dow,true) & " " & monthname(mo,true) & " " & dd & ", " & yr
value = mo & "-" & dd & "-" & yr
if dow=vbSunday then
response.write "<option> </option>" & vbCrLf
end if
if value=default1 then
selected=" selected"
else
selected=""
end if
if ((dow<>vbsunday and dow<>vbsaturday) or not skip) then
response.write "<option value=""" & value & """" & selected & ">" & option1 & "</option>" & vbCrLf
end if
next
response.write "</select>"
End Sub
%>
</body>
</html>
I would like to modify this so that the first available date that can be selected is five BUSINESS days out. The script only shows Mon-Fri so if the date is Tue Jul 13, 2004, Tue Jul 20, 2004 needs to be displayed. I've reached an impasse. :(
Ash
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<%
dateDropDown "datepicker1", 30, "DropDate"
Sub DateDropDown(name, size, default1)
'size = the number of days to display in the drop down
'default1 = default date selected in m-d-yyyy format (any non-date string is considered the current date)
'skip = if set then the program will skip Sundays and Saturdays
dim skip,today,dow,selected,option1,value,theday,mo,yr ,dd
skip = true
today = Date()
if not isdate(default1) then 'set default to current date
default1=month(today) & "-" & day(today) & "-" & year(today)
end if
response.write "<select name=" & name & " style=""font-family: monospace;"">" & vbCrLf
for i = 0 to size
theday = dateserial(Year(today),Month(today),Day(today)+i) 'automatically adjusts to correct date
dow = weekday(theday)
mo = month(theday)
yr = year(theday)
dd = day(theday)
option1 = weekdayname(dow,true) & " " & monthname(mo,true) & " " & dd & ", " & yr
value = mo & "-" & dd & "-" & yr
if dow=vbSunday then
response.write "<option> </option>" & vbCrLf
end if
if value=default1 then
selected=" selected"
else
selected=""
end if
if ((dow<>vbsunday and dow<>vbsaturday) or not skip) then
response.write "<option value=""" & value & """" & selected & ">" & option1 & "</option>" & vbCrLf
end if
next
response.write "</select>"
End Sub
%>
</body>
</html>