programming-examples/asp/More_Code_Snippets/Check if a date is valid.asp

19 lines
522 B
Plaintext
Raw Normal View History

2019-11-18 14:25:58 +01:00
<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"))
If isDate(strDate) Then
dteDate = CDate(strDate)
blnValid = True
Else
Response.Write "You entered an invalid date"
End If
If blnValid = True Then
Response.Write "The date you entered was " & dteDate
End If
End If
%>