%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 be the right-hand value in an addition or subtraction operation. The left-hand value 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 left-hand 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 232.

For more information, see Date Operations or Built-in Functions.



[ Top of Page | Previous Page | Next Page | Contents | Index ]