MONTHS_BETWEEN_UDF
Definition
Reproduce the MONTHS_BETWEEN functionality
MONTHS_BETWEEN_UDF(FIRST_DATE TIMESTAMP_LTZ, SECOND_DATE TIMESTAMP_LTZ)
Parameters
FIRST_DATE
TIMESTAMP_LTZ
The first or starting date to be processed in the function.
SECOND_DATE
TIMESTAMP_LTZ
The second or ending date that determines the end of the count.
Returns
The number of months between the first and the second date.
Usage example
Input:
SELECT MONTHS_BETWEEN_UDF('2022-02-14', '2021-02-14');
Output:
12
Last updated