Unicode Intrinsic Functions - IsDateTime Method

Test if the variable is a datetime

Member of Unicode Intrinsic Functions (PRIM_LIBI.IUnicodeIntrinsics)

Parameters

Name Type Data Type Description
Result *Result (Optional) Boolean True if the variable is a valid datetime
Format *Input (Optional) Enumeration Format of the datetime

Details

IsDateTime will return True if the variable can be converted to a valid datetime in the specified format.
 
IsDateTime will often be used before AsDateTime to better handle potential errors.

Allowed Formats

Enum Value Description
CCYYDDMMHHMMSS e.g. "20153105113045"
CCYYMMDDHHMMSS e.g. "20150531113045"
HHMMSSDDMMCCYY e.g. "11304531052015"
HHMMSSDDMMYY e.g. "113045310515"
ISO e.g. "2015-05-31 11:30:45"
Localized_SQL e.g. "2015-05-31 11:30:45"
SQL e.g. "2015-05-31 11:30:45"
TZ e.g. "2015-05-20T01:16:05Z" or "2015-05-20T01:18:17+10:00" if appending the UTC offset

Example

In this example, IsDateTime expects a variable in the format CCYYMMDDHHMMSS
If (#Variable.IsDateTime(CCYYMMDDHHMMSS)
   #Datetime := #Variable.AsDateTime(CCYYMMDDHHMMSS)
Endif

See also

All Component Classes

Technical Reference

LANSA Version 15, April 2020