TD_WEEK_OF_YEAR_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 determines which "full week" of the year is based on a date. It is equivalent to the TD_WEEK_OF_YEAR and the WEEKNUMBER_OF_YEAR functions from Teradata.

PUBLIC.TD_WEEK_OF_YEAR_UDF(INPUT TIMESTAMP_TZ)

Parameters

INPUT TIMESTAMP_TZ

Date to get the number of week from.

Returns

A number that represents the week number the date belongs to.

Usage example

Input:

SELECT PUBLIC.WEEK_OF_YEAR_UDF(DATE '2024-05-10'),
PUBLIC.WEEK_OF_YEAR_UDF(DATE '2020-01-03')

Output:

18, 0

Last updated