%YEARS (Number of Years)

%YEARS(number)

%YEARS converts a number into a duration that can be added to a date or timestamp value.

%YEARS can only follow the plus or minus sign in an addition or subtraction expression. The value before the plus or minus sign must be a date or timestamp. The result is a date or timestamp value with the appropriate number of years added or subtracted. For a date, the resulting value is in *ISO format.

If the date represented by the date or timestamp value is February 29 and the resulting year is not a leap year, February 28 is used instead. Adding or subtracting a number of years to a February 29 date may not be reversible. For example, 2000-02-29 + %YEARS(1) - %YEARS(1) is 2000-02-28.

For an example of the %YEARS built-in function, see Figure 1.

For more information, see Date Operations, Built-in Functions, and Unexpected Results.