Purpose
Returns the conversion of a specified date from one format (Gregorian, calendar, European, or Julian) to another.
Date change functions can be coded two ways, as shown in the following syntax diagrams.
Syntax
Format 1:
►►───┬─ DATECHG ──┬─ ( date, input-date-format, output-date-format ) ─────────►◄ └─ DATECHGX ─┘
Format 2:
►►───┬─ GCDATE ───┬─ ( date ) ────────────────────────────────────────────────►◄ ├─ GCDATEX ──┤ ├─ GEDATE ───┤ ├─ GEDATEX ──┤ ├─ GJDATE ───┤ ├─ GJDATEX ──┤ ├─ CGDATE ───┤ ├─ CGDATEX ──┤ ├─ CEDATE ───┤ ├─ CEDATEX ──┤ ├─ CJDATE ───┤ ├─ CJDATEX ──┤ ├─ EGDATE ───┤ ├─ EGDATEX ──┤ ├─ ECDATE ───┤ ├─ ECDATEX ──┤ ├─ EJDATE ───┤ ├─ EJDATEX ──┤ ├─ JGDATE ───┤ ├─ JGDATEX ──┤ ├─ JCDATE ───┤ ├─ JCDATEX ──┤ ├─ JEDATE ───┤ └─ JEDATEX ──┘
Parameters
Format 1:
Converts the input date value to the specified output date format. DATECHGX operates on dates that contain the century portion of the year.
A numeric value that specifies the input date.
Date can be:
Specifies the format of date.
Input-date-format can be:
Specifies the format to which the input date date is converted.
Output-date-format can be:
Input-date-format and output-date-format can be:
Format 2:
Using format 2, the first character of each function name identifies the format of the input date. The second character identifies the format to which the date is converted, as follows:
For example, the GCDATE function converts from Gregorian to Calendar format.
Function names ending with X operate on values that contain the century portion of the year.
A numeric value that specifies the input date.
Examples
Using format 1 (DATECHG)
In this example, the DATECHG format of the date change function is used to convert January 28, 1958 from Gregorian to calendar format:
Statement:
MOVE DATECHG(580128,'G','C') TO WK-RESULT.
Returned value: 012858
Similarly, the DATECHGX function converts a date containing the century. Here, WK-RESULT must contain an 8 character result:
Statement:
MOVE DATECHGX(19580128,'G','C') TO WK-RESULT.
Returned value: 01281958
Using format 2 (GCDATE ...)
In this example, the GCDATE format is used to convert January 28, 1958 from Gregorian to calendar format:
Statement:
MOVE GCDATE (580128) TO WK-RESULT.
Returned value: 012858
In this example, GCDATEX is used to convert September 12, 1929 from Gregorian to calendar format. The result contains the century portion of the year:
Statement:
MOVE GCDATEX(19290912) TO WK-RESULT.
Returned value: 09121929
|
Copyright © 2014 CA.
All rights reserved.
|
|