The DATEFMT formats/reformats a date value. This function also converts a two (2) digit year to a four (4) digit year using a window value of 50. If the source data contains a two (2) digit year, it will automatically converted to a four (4) digit year. This is done by adding 2000 if the source year is less than 50 and adding 1900 if the source year is greater than or equal to 50.
Category
Date / Time
DATEFMT(source_date, source_format, target_format)
Parameters and Descriptions
Parameter | Description |
---|---|
source_date |
This parameter specifies a source date in the format specified in the parameter source_format. |
source_format |
This parameter specifies the format of the source date. This parameter is expressed using three (3) mandatory characters (Y, M, D) as follows: YMD - year, month, day DMY - day, month, year MDY - month, day, year An optional separator character can be specified after the mandatory characters (i.e. YMD/, YMD-. The source_format parameter must be enclosed in single quotes ('). |
target_date |
This is the desired format of the target date that will be returned by the DATEFMT function. This parameter is expressed using three (3) mandatory characters (Y, M, D) as follows: YMD - year, month, day DMY - day, month, year MDY - month, day, year An optional separator character can be specified after the mandatory characters (i.e. YMD/, YMD-. The target_format parameter must be enclosed in single quotes ('). |
Example
REFMT_DATE
.REFMT_DATE = DATEFMT('01/05/2003', 'DMY/', 'YMD-')