How to: |
The DATECVT function converts the field value of any standard date format or legacy date format into a date format (offset from the base date), in the desired standard date format or legacy date format. If you supply an invalid format, DATECVT returns a zero or a blank.
DATECVT(date, 'in_format', output)
where:
Date
Is the date to be converted. If you supply an invalid date, DATECVT returns zero. When the conversion is performed, a legacy date obeys any DEFCENT and YRTHRESH parameter settings supplied for that field.
Alphanumeric
Is the format of the date enclosed in single quotation marks. It is one of the following:
Alphanumeric
Is the output format. It is one of the following:
This example first converts a numeric date, NUMDATE, to a character date, and then assigns the result to a non-date alphanumeric field, CHARDATE.
CHARDATE/A13 = DATECVT (NUMDATE,'I8YYMD','A8YYMD');
Note: DATECVT does not use an output format; it uses the format of the argument output_format for the result.
iWay Software |