How to: |
The DATECVT function converts the field value of any standard date format or legacy date format into a new 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_format)
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, either standard, legacy, or non-date.
For example:
Alphanumeric
Is the output date format, either standard, legacy, or non-date.
For example:
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 |