I have a problem with a bit of asp used in a date selection box.
It is supposed to get the right days and dates and then list them in the select box for up to a week ahead. The error i get is Out Of Memory specifically the line reading:
ReDim daysOfWeek(strDaysTaken)
Here is the code:
Any help would be really appreciated.
Thanks.
It is supposed to get the right days and dates and then list them in the select box for up to a week ahead. The error i get is Out Of Memory specifically the line reading:
ReDim daysOfWeek(strDaysTaken)
Here is the code:
Code:
<select name="date">
<option value="<%=Year(Date) & "-" & Month(Date) & "-" & Day(Date)%>">Today</option>
<option value="<%=Year(DateAdd("d", 1,(Date))) & "-" & Month(DateAdd("d", 1,(Date))) & "-" & Day(DateAdd("d", 1,(Date)))%>">Tomorrow</option>
<%
startDate = Day(DateAdd("d", 2,(Date))) & " " & MonthName(Month(DateAdd("d", 2,(Date)))) & ", " & Year(DateAdd("d", 2,(Date)))
endDate = Day(DateAdd("d", 7,(Date))) & " " & MonthName(Month(DateAdd("d", 4,(Date)))) & ", " & Year(DateAdd("d", 4,(Date)))
strDaysTaken=DateDiff("d", startDate, endDate)
strDays=strDaysTaken
i=0
temp1 = 0
ReDim daysOfWeek(strDaysTaken)
ReDim datesOfWeek(strDaysTaken)
do while temp1<= strDays
temp2 = weekdayname(weekday(DateAdd("d", temp1, startDate))) & ", " & day(DateAdd("d", temp1, startDate)) & " " & MonthName(Month((DateAdd("d", temp1, startDate))),true)
temp3 = Year(DateAdd("d", temp1, startDate)) & "-" & Month(DateAdd("d", temp1, startDate)) & "-" & day(DateAdd("d", temp1, startDate))
daysOfWeek(i)= temp2
datesOfWeek(i) = temp3
%>
<option value="<%=datesOfWeek(i)%>"><%=daysOfWeek(i)%></option>
<%
i=i+1
temp1=temp1+1
loop
%>
</select>
Any help would be really appreciated.
Thanks.
