Skip to main content

YEARWEEK

Returns the year and week number in YYYYWW format, according to ISO week date. Week 1 is the week with the first Thursday of the year.

Syntax

YEARWEEK(<date_or_timestamp>)

Return Type

UInt32.

Examples

SELECT
YEARWEEK('2024-01-01') AS yw1,
YEARWEEK('2024-12-31') AS yw2;
┌─────────────────┐
│ yw1 │ yw2 │
├────────┼────────┤
202401202501
└─────────────────┘
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today