DATEDIFF_UDF (DATE, STRING)

Definition

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

DATEDIFF_UDF(D DATE, INTERVAL_VALUE STRING)

Parameters

D DATE

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

INTERVAL_VALUE STRING

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

Returns

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

Usage example

Input:

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

Output:

2021-12-30

Last updated