ROUND_DATE_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

User-defined function (UDF) that processes the DATE_VALUE with the time portion of the day rounded to the unit specified by UNIT_TO_ROUND_BY. The equivalent function in Teradata is ROUND(date).

PUBLIC.ROUND_DATE_UDF(DATE_TO_ROUND TIMESTAMP_LTZ, UNIT_TO_ROUND_BY VARCHAR(5))

Parameters

DATE_TO_ROUND TIMESTAMP_TZ

The date to be rounded.

UNIT_TO_ROUND_BY VARCHAR

The unit to round the date to.

Returns

Returns the date rounded by the unit defined in UNIT_TO_ROUND_BY.

Migration example

Input:

IN -> Teradata_01.sql
SELECT ROUND(CURRENT_DATE, 'RM') RND_DATE

Output:

OUT -> Teradata_01.sql
SELECT
PUBLIC.ROUND_DATE_UDF(CURRENT_DATE(), 'RM') RND_DATE;

Last updated