DATEDIFF_UDF (STRING, DATE)

Definition

This user-defined function (UDF) is used to generate the difference between an interval value and a date.

DATEDIFF_UDF(INTERVAL_VALUE STRING,D DATE)

Parameters

INTERVAL_VALUE STRING

The interval value that will be used to create the difference from.

D DATE

The date to be used to process the difference with the interval.

Returns

Returns a date with the resulting value of the subtraction of time.

Usage example

Input:

SELECT DATEDIFF_UDF('INTERVAL ''2-1'' YEAR(2) TO MONTH', '2024-01-30');

Output:

2021-12-30

Last updated