offset_years
function adds years
to the year component of date
.
Syntax
offset_years(date(year, month, day), years)
Parameters
date
can be any of the following:- Another function that returns a date.
- A formula column that returns a date.
year
: 4 digits.
For example, 2012month
: 2 digits.
For example, 01 or 12day
: 2 digits.
For example, 01 or 30years
- Positive: Counts forward
- Negative: Counts backward
- Example
Example
offset_years(date(2020,12, 25), 5)
= 2025-12-25