|
How to: |
DT_FORMAT converts a date or date-time value to an alphanumeric string in a specified date or date-time format. For information about date and date-time formats, see the Describing Data With WebFOCUS Language manual.
DT_FORMAT(date,'date_format')
where:
Numeric, date, or date-time
Is the date or date-time field or value to be converted.
Alphanumeric literal
Is a date or date-time format that fits the input date format type, enclosed in single quotation marks.
The following request converts date and date-time values to alphanumeric values with specified date and date-time formats.
DEFINE FILE VIDEOTRK
NEWDT1/A12 = DT_FORMAT(TRANSDAT,'YYMD');
NEWDT2/A30 = DT_FORMAT(DT_CURRENT_DATETIME(SECOND),'HYYMTDs');
NEWDT3/A30= DT_FORMAT('April 1, 2019','YYMDTr');
END
TABLE FILE VIDEOTRK
PRINT NEWDT1 NEWDT2 NEWDT3
BY TRANSDAT
WHERE OUTPUTLIMIT EQ 1
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF,$
END
The output is shown in the following image.
