How to check string, is it date object or not in ColdFusion

IsDate() - check a string, is it date object or not

IsDate.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>IsDate function example: how to check string, is it date object or not</title>
</head>

<body>
<h2 style="color:hotpink">IsDate Function Example</h2>

<cfset ToDay=DateFormat(Now())>
<cfset Myname="Jones">
<cfoutput>
<b>
ToDay: #ToDay#
<br />
MyName: #MyName#
<br /><br />
</b>
</cfoutput>

<table style="color:LightGreen; background:Green;" border="1" bordercolor="DarkGreen">
    <tr>
     <td style="font-weight:bold">IsDate</td>
     <td style="font-weight:bold">Output</td>
    </tr>
    <tr>
     <td>#IsDate(ToDay)#</td>
     <td><cfoutput>#IsDate(ToDay)#</cfoutput></td>
    </tr>
    <tr>
     <td>#IsDate(MyName)#</td>
     <td><cfoutput>#IsDate(MyName)#</cfoutput></td>
    </tr>
</table>

</body>
</html>





More ColdFusion examples