DATEDIFF_UDF (STRING, DATE)

Important Notice: Migration of Documentation Website

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

Official Snowflake Snowconvert Documentation

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected].

Thank you for your understanding.

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