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.
IsDate(string)
Any string value.
Years from 0 to 29 are interpreted as 21st century values. Years 30 to 99 are interpreted as 20th century values.
<!--- 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>