Validate Date in ASP with IsDate() 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 code examples:

<%

Response.Write IsDate("January 13, 2003") ‘ Prints True
Response.Write IsDate(#1/13/03#) ‘ Prints True
Response.Write IsDate("This is not a date") ‘ Prints False
Response.Write IsDate("10:55") ‘ Prints True

%>

No Comments yet »

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Niche Marketing