Skip to main content
On this page

Kater SQL Functions Date parts

KATER__DAY_OF_QUARTER

The day of its quarter, counted from 1.

Family: Date parts

Syntax

KATER__DAY_OF_QUARTER(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

  • 1 April is day 1 of its quarter, and 30 June is day 91.

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_day_of_quarter', KATER__DAY_OF_QUARTER(orders.order_date)) AS "Day of Quarter"
FROM kater_dataset.orders AS orders
ORDER BY
1
LIMIT 3
Order IDOrder DateDay of Quarter
O000002025-05-2656
O000012025-11-2859
O000022025-07-2525

Compiles to

DATE_DIFF(
'DAY',
CAST(DATE_TRUNC('QUARTER', orders.order_date) AS DATE),
CAST(orders.order_date AS DATE)
) + 1
DATEDIFF(
DAY,
CAST(DATE_TRUNC('QUARTER', orders.order_date) AS DATE),
CAST(orders.order_date AS DATE)
) + 1

See also