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
└─────────────────┘
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today