392
IsDate
Returns TRUE if string can be converted to a date/time value; otherwise, FALSE. Note
that ColdFusion converts the Boolean return value to its string equivalent, "Yes" and
"No."
See also ParseDateTime, CreateDateTime, and IsNumericDate.
Syntax
IsDate( string )
string
Any string value.
Usage
Years from 0 to 29 are interpreted as 21
th
as 20
century values.
Examples
<!--- This example shows the use of IsDate --->
<HTML>
<HEAD>
<TITLE>
IsDate Example
</TITLE>
</HEAD>
<BODY BGCOLOR=silver>
<H3>IsDate Example</H3>
<CFIF IsDefined("FORM.theTestValue")>
<CFIF IsDate(FORM.theTestValue)>
<H3>The string <CFOUTPUT>#DE(FORM.theTestValue)#</CFOUTPUT>
is a valid date</H3>
<CFELSE>
<H3>The string <CFOUTPUT>#DE(FORM.theTestValue)#</CFOUTPUT>
is not a valid date</H3>
</CFIF>
</CFIF>
<FORM ACTION="isDate.cfm" METHOD="POST">
<P>Enter a string, and discover if
it can be evaluated to a date value.
<P><INPUT TYPE="Text" NAME="TheTestValue"
VALUE="<CFOUTPUT>#Now()#</CFOUTPUT>">
<INPUT TYPE="Submit" VALUE="Is it a Date?" NAME="">
</FORM>
</BODY>
</HTML>
st
century values. Years 30 to 99 are interpreted
CFML Language Reference
Need help?
Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?
Questions and answers