Código fuente de 'Valida fechas.asp'
<html>
<head>
<title>Valida fechas - Códigos asp, programacion asp, descargas asp, rutinas asp</title>
</head>
<body style="font-family: Arial; font-size: 9pt">
<p align="center"><b><font size="3">Valida fechas</font></b></p>
<form action="Valida fechas.asp">
Salida:
<%call showdateform("depart")%>
<br>
Llegada:
<%call showdateform("arrive")%>
<input type="submit" value="¡A viajar!">
</form>
<%
sub showdateform(mylistname)
call showmonth(mylistname)
call showday(mylistname)
call showyear(mylistname)
end sub
%>
<%sub showmonth(listname)%>
<select name="<%=listname%>month">
<%
dim monthname
monthname=array("Ene","Feb","Mar","Abr", _
"May","Jun","Jul","Ago", _
"Sep","Oct","Nov","Dic")
for counter=0 to 11
temp=monthname(counter)
response.write "<option value='" & counter+1
response.write "'>" & temp & "</option>"
next%>
</select>
<%end sub%>
<%sub showday(listname)%>
<select name="<%=listname%>day">
<%for counter=1 to 31
response.write "<option>" & counter & "</option>"
next%>
</select>
<%end sub%>
<%sub showyear(listname)%>
<select name="<%=listname%>year">
<%for counter=1964 to 2005
response.write "<option>" & counter & "</option>"
next%>
</select>
<%end sub%>
<%
dday=request("departday")
dmonth=request("departmonth")
dyear=request("departyear")
departdate=dday & "/" & dmonth & "/" & dyear
aday=request("arriveday")
amonth=request("arrivemonth")
ayear=request("arriveyear")
arrivedate=aday & "/" & amonth & "/" & ayear
If isdate(departdate) then
response.write "La fecha de salida '" & departdate & "' es correcta<br>"
elseif departdate<>"//" then
response.write "La fecha de salida '" & departdate & "' es incorrecta<br>"
end if
If isdate(arrivedate) then
if arrivedate>=departdate then
response.write "La fecha de llegada '" & arrivedate & "' es correcta<br>"
else
response.write "La fecha de llegada '" & arrivedate & "' es anterior a la fecha de partida<br>"
end if
elseif arrivedate<>"//" then
response.write "La fecha de llegada '" & arrivedate & "' es incorrecta<br>"
end if
%>
</BODY></HTML>