YEAR_BEGIN_ISO_UDF

Definition

UDF that reproduces the TD_YEAR_BEGIN(Date, 'ISO') functionality. It depends on the DAYOFWEEKISO of PUBLIC.FIRST_DAY_JANUARY_OF_ISO_UDF add or subtraction days to find the Monday closer to PUBLIC.FIRST_DAY_JANUARY_OF_ISO_UDF.

PUBLIC.YEAR_BEGIN_ISO_UDF(INPUT DATE)

Parameters

INPUT TIMESTAMP_TZ

The date to get the first day of the year using the ISO calendar.

Returns

The first day of the year using the ISO calendar.

Usage example

Input:

SELECT  PUBLIC.YEAR_BEGIN_ISO_UDF(DATE '2022-01-01'),
PUBLIC.YEAR_BEGIN_ISO_UDF(DATE '2022-04-12');

Output:

2021-01-04, 2022-01-03

Last updated