You need to determine whether a string or numeric value is a valid date object.
Use isDate() or LSIsDate() for strings, or isNumericDate() for numeric values.
The isDate() function returns True if the specified string can be converted to a valid date/time object. Be sure to enclose literal dates in quotation marks.
<cfoutput>
<cfset x="12-31-2002">
#isDate(x)#<BR>
#isDate('12/31/2002')#<BR>
#isDate('Dec 31, 2002')#<BR>
#isDate('13/31/2002')#<BR>
#isDate('19:00')#<BR>
#isDate('7pm')#
</cfoutput>
You should be aware that the isDate() function only works with
dates formatted for the U.S. locale. If you have a date formatted
using a different locale, you should use the LSIsDate() function.
It returns True if the specified date can be converted to a
date/time object in the current locale or False if not.
If you need to determine whether a numeric value (real
number) is a valid date/time object, you can use the
isNumericDate() function. Like isDate(), it returns True if the
value you pass to it can be converted to a date/time object.
<cfoutput> #isNumericDate(37621.79167)#<BR> #isNumericDate(-1)# </cfoutput>
Because isNumericDate() operates on numeric values, it can be used in any locale.
+