Search Search

#1 worldwide
FREE Coding Lessons

since 1996
   THE BEST WAY to learn ASP & Asp.net!
Advertise Here!
click for details
Credits Host:
DiscountASP.net
Server Admin:
The "Team"
Contact Info.
Charles M. Carroll

my Blog

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

<Test Script Below>


<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>

Chaz Wish List
Tall Tip $5
Grande Tip $20
Venti Tip $39
Tip Jar Thanks
2004 Thanks
2005 Thanks
HUGE Tip -love site