Skip to main content
On this page

Kater SQL Functions Date parts

KATER__WEEK_OF_YEAR

The ISO week of its year, from 1 to 53.

Family: Date parts

Syntax

KATER__WEEK_OF_YEAR(field)

Arguments

ArgumentDescription
fieldThe date or timestamp.

Returns

A whole number. The field menu writes @format plain beside it, so it shows without a thousands separator.

Usage notes

  • A day in early January can be in week 52 or 53 of the year before, and a day in late December in week 1.
  • On Snowflake, the account’s WEEK_OF_YEAR_POLICY setting can change the numbers.

Example

This Sandbox query reads the sample shop’s orders. The table shows the rows that Kater gave.

SELECT
orders.order_id AS "Order ID",
orders.order_date AS "Order Date",
DIMENSION('order_date_week_of_year', KATER__WEEK_OF_YEAR(orders.order_date)) AS "Week of Year"
FROM kater_dataset.orders AS orders
ORDER BY
1
LIMIT 3
Order IDOrder DateWeek of Year
O000002025-05-2622
O000012025-11-2848
O000022025-07-2530

Compiles to

EXTRACT(WEEK FROM orders.order_date)
DATE_PART(WEEK, orders.order_date)

See also