WEEK_CLAIM scalar function

Returns the week of the year that ADATE exists within, according to the CLAIM calendar.

Prototypes

WEEK_CLAIM(ADATE DATE)
WEEK_CLAIM(ADATE TIMESTAMP)
WEEK_CLAIM(ADATE VARCHAR(26))

RETURNS SMALLINT

Description

Returns the week of the year of ADATE, according to the CLAIM calendar. ADATE can be expressed as a DATE value, a TIMESTAMP, or a VARCHAR containing a valid string representation of a date or timestamp. If ADATE is NULL, the result is NULL. Otherwise, the result is a SMALLINT between 1 and 53.

Parameters

ADATE
The date to calculate the week of year for, according to the CLAIM calendar.

Examples

Calculate the CLAIM week for the 2nd of January, 2010:

VALUES WEEK_CLAIM(DATE(2010, 1, 2));
1
------
     2

Calculate the CLAIM week for the 31st of December, 2010:

VALUES WEEK_CLAIM('2010-12-31');
1
------
     1