Skip to main content
On this page

Kater SQL Functions Date grains

KATER__HOUR

The start of the hour the timestamp is in.

Family: Date grains

Syntax

KATER__HOUR(field)

Arguments

ArgumentDescription
fieldThe timestamp, or a time of day.

Returns

A timestamp.

Usage notes

  • A date has no time of day, so the compiler refuses it on a date.

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.ordered_at AS "Ordered At",
DIMENSION('ordered_at_hour', KATER__HOUR(orders.ordered_at)) AS "Hour"
FROM kater_dataset.orders AS orders
ORDER BY
1
LIMIT 3
Order IDOrdered AtHour
O000002025-05-26T09:02:002025-05-26T09:00:00
O000012025-11-28T09:21:002025-11-28T09:00:00
O000022025-07-25T13:56:002025-07-25T13:00:00

Compiles to

The call compiles to the same SQL on DuckDB and on Snowflake.

DATE_TRUNC('HOUR', orders.ordered_at)

See also