YEAR_DIFF
Description
YEAR_DIFF
is a row function that calculates the fractional number of
years between two date
values (value1
-
value2
).Syntax
YEAR_DIFF
(date_1
,date_2
)Return Value
Returns one value per row of type
Double
.Input Parameters
- date_1
- Required. A field or expression of typeDate.
- date_2
- Required. A field or expression of typeDate.
Examples
Calculate the number of years a user has been a customer by subtracting the value of the
registration_date
field from the current date (the result of the TODAY
expression):YEAR_DIFF(TODAY(),[registration_date])
Calculate a user's age by subtracting the value of the
birthdate
field from the
current date (the result of the TODAY
expression):YEAR_DIFF(TODAY(),[birthdate])