Validate Date in ASP – IsDate VBScript function
The IsDate VBScript function offers an easy way to validate a date in your
server-side ASP code. As you might have expected the IsDate VBScript function
takes only one parameter – date or string that represents any valid date/time
format. The IsDate function returns a Boolean value (True or False) indicating
whether an expression is a valid date or can be converted to a valid date. To
illustrate the usage of IsDate function let’s have a look at the following
self-explanatory examples:
<%
Response.Write IsDate("January 1, 2004") ' Prints True
Response.Write IsDate(#1/1/04#) ' Prints True
Response.Write IsDate("This is not a valid date") ' Prints False
Response.Write IsDate("10:54") ' Prints True
%>
|