Ads |
|
 |
|
Products |
|
 |
|
|
|
 |
 |
 |
|
|
Check if a date is valid
This example displays a form on a page . The user then enters a date , if the date is invalid then a message will be displayed on the screen . Examples of valid dates are as follows
12-12-03
12/12/03
|
<form method ="post" action="<%= Request.ServerVariables("SCRIPT_NAME") %>">
<input type ="text" name="date"><br>
<input type="submit">
</form>
<%
Dim strDate , blnValid , dteDate
If Request.ServerVariables("CONTENT_LENGTH") <>0 Then
strDate = Trim(Request.Form("date"))
'check and see if the user entry is a date
If isDate(strDate) Then
dteDate = CDate(strDate)
'set variable to true
blnValid = True
Else
'display invalid date message
Response.Write "You entered an invalid date"
End If
'displayvalid date message
If blnValid = True Then
Response.Write "The date you entered was " & dteDate
End If
End If
%> |
|
|
|
|
|
|
 |
 |
 |
Products |
|
 |
|
|
Comparison |
|
 |
|
|
Ads |
|
 |
|
|
|