Smart dates are stored as the number of days lapsed since December 31, 1900 (base date). Fields in this format can be easily manipulated and compared to other date fields. Below are some examples using the field AC:BRTHDATE which has a MDYY format.
-
In a table request, you can provide a new display format by simply specify the display format (e.g., 06-15-1960).
PRINT AC:BRTHDATE/M-D-YY
-
To display the date in a natural date literal, (e.g., JUN 15, 1960) simply specify the display format in a table report request.
PRINT AC:BRTHDATE/MTDYY
-
To define the date as a YYMD format, simply specify the new date format.
NEWDATE/YYMD=AC:BRTHDATE;
-
To convert the date to an alpha format, use the following define:
NEWDATE/A8MDYY=AC:BRTHDATE;
FOCUS does not support date formats without the year component (i.e., MD or DM). To select the month or day of a particular date field, you must first convert it from a smart date to an alpha format and then use an Edit define to select the date component. For example:
NEWDATE/A8MDYY=AC:BRTHDATE;
MONTH/A2=EDIT(NEWDATE, '99$$$$$$);
Here are tips for using smart dates in DEFINEs:
-
Date values must be enclosed in single quotes.
TEST/A3=IF AC:APPTXDTE GT '05291998'
THEN 'YES' ELSE 'NO';
-
Date values which display as 'blank' are actually stored as the integer 0. Use that value when screening.
TEST/A3 = IF AC:APPTXDTE EQ '0'
THEN 'YES' ELSE 'NO';
To learn more about smart dates, refer to your FOCUS documentation.
Last Updated: February 22, 2024