The YEAR-TO-YYYY function converts argument-1, the two low-order digits of a year, to a four-digit year. Argument-2, when added to the year at the time of execution, defines the ending year of a 100-year interval, or sliding window, into which the year of argument-1 falls. The type of this function is integer.
General Format
FUNCTION YEAR-TO-YYYY ( argument-1 [argument-2] )
Arguments
- Argument-1 must be a nonnegative integer less than 100.
- Argument-2 must be an integer.
- If argument-2 is omitted, the function is evaluated as though 50 were specified.
- The sum of the year at the time of execution and the value of argument-2 must be less than 10,000 and greater than 1699.
Returned Values
- Maximum-year is calculated as follows:
(FUNCTION NUMVAL (FUNCTION CURRENT-DATE (1:4)) + argument-2)
where argument-2 of the NUMVAL function is the same as argument-2 of the YEAR-TO-YYYY function itself.
- The equivalent arithmetic expression is:
- When the following condition is true:
FUNCTION MOD (maximum-year, 100) > = argument-1
The equivalent arithmetic expression is:
(argument-1 + 100 * (FUNCTION INTEGER (maximum-year/100)))
- Otherwise, the equivalent arithmetic expression is:
(argument-1 + 100 * (FUNCTION INTEGER (maximum-year/100) - 1))
Notes
(fixed-maximum-year - FUNCTION NUMVAL (FUNCTION CURRENT-DATE (1:4)))
If the fixed window is 1973 through 2072, then in 2009 argument-2 has the value 63 and in 2019, the value 53.