10 6 2 AsDate

LANSA Technical

10.6.2 AsDate

AsDate will return a date based on the value of the string and the specified format.

If the supplied value does not conform to the required format, the application will end with a run-time error. Use the IsDate intrinsic to test the value before attempting to convert to a date.

Input Parameters

Format - Date format expected in the numeric variable

Allowable formats are

CCYY/DD/MM

CCYY/MM/DD

CCYYDDMM

CCYYMM

CCYYMMDD

DD/MM/CCYY

DD/MM/YY

DDMMCCYY

DDMMYY

ISO

MM/DD/CCYY

MM/DD/YY

MMCCYY

MMDDCCYY

MMDDYY

MMYY

SysFmt6

SysFmt8

xYYMMDD

YY/MM/DD

YYMM

YYMMDD

Example

If (#String.isDate(ddmmyy)

 

#Date := #string.AsDate(ddmmyy)

 

else

 

* Error processing

 

Endif

 

Also see

Date Format

Ý 10.6 Alphanumeric/String Intrinsic Functions