On this page
Kater SQL Functions Date grains
KATER__YEAR
The first day of the year the date is in.
Family: Date grains
Syntax
KATER__YEAR(field)Arguments
| Argument | Description |
|---|---|
field | The date or timestamp. |
Returns
A date.
Usage notes
- On a timestamp, it drops the time of day too. So 14 March 2026 at 09:30 gives 1 January 2026.
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_year', KATER__YEAR(orders.order_date)) AS "Year"FROM kater_dataset.orders AS ordersORDER BY 1LIMIT 3| Order ID | Order Date | Year |
|---|---|---|
| O00000 | 2025-05-26 | 2025-01-01 |
| O00001 | 2025-11-28 | 2025-01-01 |
| O00002 | 2025-07-25 | 2025-01-01 |
Compiles to
The call compiles to the same SQL on DuckDB and on Snowflake.
CAST(DATE_TRUNC('YEAR', orders.order_date) AS DATE)See also
- Dates
- Other functions in Date grains:
KATER__DATE,KATER__WEEK,KATER__MONTH,KATER__QUARTER,KATER__HOUR,KATER__MINUTE,KATER__SECOND,KATER__MILLISECOND