TIME_DIFFERENCE_UDF

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

Gets the difference between two times.

PUBLIC.TIME_DIFFERENCE_UDF
(MINUEND TIME, SUBTRAHEND TIME, INPUT_PART VARCHAR)

Parameters

MINUEND TIMESTAMP

Time subtracted from.

SUBTRAHEND TIMESTAMP

Time subtracted.

INPUT_PART VARCHAR

Parts to be returned.

EXTRACT_PART VARCHAR

Extract numeric value extracted from the interval.

Returns

A varchar value with the time.

Example

Input:

IN -> Teradata_01.sql
select extract(day from (timestampColumn1 - timestampColumn2 day to hour)) from tableName;

Output:

OUT -> Teradata_01.sql
SELECT
EXTRACT_TIMESTAMP_DIFFERENCE_UDF(timestampColumn1, timestampColumn2, 'DAY TO HOUR', 'DAY')
                                 from
tableName;

Last updated