Skip to main content

YEARWEEK

根据 ISO 周日期返回 YYYYWW 格式的年份和周数。第 1 周是当年第一个星期四所在的周。

语法

YEARWEEK(<date_or_timestamp>)

返回类型

UInt32。

示例

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