|
Subroutines - Choosing/Validating
Dates #2 by Charles Carroll
The form handler for the previous example could validate and
manipulate dates using some built-in VBscript date handling routines, for example:
- isdate() to validate a date
filename=/learn/test/subdatesrespond.asp
<HEAD><TITLE>subdatesrespond.asp</TITLE></HEAD>
<HTML><body bgcolor="#FFFFFF">
<%
dday=request.querystring("departday")
dmonth=request.querystring("departmonth")
dyear=request.querystring("departyear")
departdate=dday & "/" & dmonth & "/" & dyear
aday=request.querystring("arriveday")
amonth=request.querystring("arrivemonth")
ayear=request.querystring("arriveyear")
arrivedate=aday & "/" & amonth & "/" & ayear
If isdate(departdate) then
response.write "Departure Date is Valid Date<br>"
else
response.write "Departure Date is INVALID<br>"
end if
If isdate(arrivedate) then
response.write "Arrival Date is Valid Date<br>"
else
response.write "Arrival Date is INVALID<br>"
end if
%>
</BODY></HTML>
|