How to: Reference: |
Available Languages: reporting, Maintain
The CHGDAT function rearranges the year, month, and day portions of an input character string representing a date. It may also convert the input string from long to short or short to long date representation. Long representation contains all three date components: year, month, and day; short representation omits one or two of the date components, such as year, month, or day. The input and output date strings are described by display options that specify both the order of date components (year, month, day) in the date string and whether two or four digits are used for the year (for example, 97 or 1997). CHGDAT reads an input date character string and creates an output date character string that represents the same date in a different way.
Note: CHGDAT requires a date character string as input, not a date itself. Whether the input is a standard or legacy date, convert it to a date character string (using the EDIT or DATECVT functions, for example) before applying CHGDAT.
The order of date components in the date character string is described by display options comprised of the following characters in your chosen order:
Character |
Description |
---|---|
D |
Day of the month (01 through 31). |
M |
Month of the year (01 through 12). |
Y[Y] |
Year. Y indicates a two-digit year (such as 94); YY indicates a four-digit year (such as 1994). |
To spell out the month rather than use a number in the resulting string, append one of the following characters to the display options for the resulting string:
Character |
Description |
---|---|
T |
Displays the month as a three-letter abbreviation. |
X |
Displays the full name of the month. |
Display options can consist of up to five display characters. Characters other than those display options are ignored.
For example: The display options 'DMYY' specify that the date string starts with a two digit day, then two digit month, then four digit year.
Note: Display options are not date formats.
WebFOCUS |