# date_trunc

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [cloud-data-platform-full.txt](https://docs.redpanda.com/cloud-data-platform-full.txt)

---
title: date_trunc
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-connect-version: 4.93.0
latest-redpanda-tag: v26.1.9
docname: sql/sql-functions/timestamp-functions/date-trunc
page-component-name: cloud-data-platform
page-version: master
page-component-version: master
page-component-title: Cloud
page-relative-src-path: sql/sql-functions/timestamp-functions/date-trunc.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/reference/pages/sql/sql-functions/timestamp-functions/date-trunc.adoc
description: The `date_trunc()` function truncates a timestamp, timestamp with time zone or interval value to the specified precision, effectively rounding down the value to the start of the given time unit.
page-topic-type: reference
page-git-created-date: "2026-05-26"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/cloud-data-platform/reference/sql/sql-functions/timestamp-functions/date-trunc.md -->

The `date_trunc()` function truncates a timestamp, timestamp with time zone or interval value to the specified precision, effectively rounding down the value to the start of the given time unit. The return type matches the input type.

## [](#syntax)Syntax

The syntax for using the `date_trunc()` function is:

Without time\_zone

```sql
DATE_TRUNC(field, source)
```

With time\_zone

```sql
DATE_TRUNC(field, source, time_zone)
```

## [](#parameters)Parameters

-   `field`: The unit of time used to truncate the `source` value. Type: `text`. Case-insensitive.

-   `source`: The value to truncate. Must be of type `interval`, `timestamp`, or `timestamp with time zone`.

-   `time_zone`: Optional. Time zone for the operation. Type: `text`. Used only with the second syntax form.


## [](#fields)Fields

Here is a list of supported values available to specify the fields param in `date_trunc()` syntax.

-   `microseconds`

-   `milliseconds`

-   `second`

-   `minute`

-   `hour`

-   `day`

-   `week`

-   `month`

-   `quarter`

-   `year`

-   `decade`

-   `century`

-   `millennium`


> 📝 **NOTE**
>
> Some fields like `microseconds` and `milliseconds` are supported only for interval types.

## [](#examples)Examples

### [](#truncate-to-year)Truncate to year

This example truncates the timestamp to the year level.

```sql
select DATE_TRUNC('year', '1911-12-02 19:40:00'::timestamp);
```

The timestamp **"1911-12-02 19:40:00"** has been truncated to 1911, with the month and day set to January 1st.

```sql
         date_trunc
----------------------------
 1911-01-01 00:00:00.000000
```

### [](#truncate-to-day)Truncate to day

This query truncates the timestamp **“1911-12-02 19:40:00”** to the day level.

```sql
select DATE_TRUNC('day', '1911-12-02 19:40:00'::timestamp);
```

The timestamp has been truncated to the same day, year, month, and day components.

```sql
        date_trunc
----------------------------
 1911-12-02 00:00:00.000000
```

### [](#truncate-to-week)Truncate to week

This query truncates the timestamp **“1911-12-02 19:40:00”** to the week level.

```sql
select DATE_TRUNC('week', '1911-12-02 19:40:00'::timestamp);
```

The timestamp has been truncated to the start of the week containing the date, which is Monday, November 27, 1911, at 00:00:00.

```sql
        date_trunc
----------------------------
 1911-11-27 00:00:00.000000
```

### [](#truncate-to-quarter)Truncate to quarter

This query truncates the timestamp **“1911-12-02 19:40:00”** to the quarter level.

```sql
select DATE_TRUNC('quarter', '1911-12-02 19:40:00'::timestamp);
```

The timestamp is truncated to the start of the quarter. The month and day are set to the first month and first day of the quarter, with time components reset to zero.

```sql
        date_trunc
----------------------------
 1911-10-01 00:00:00.000000
```

### [](#truncate-to-hour)Truncate to hour

This query truncates the interval **“15 hours 10 minutes”** to the hour precision.

```sql
select DATE_TRUNC('hour', '15 hour 10 minutes'::interval);
```

The minutes and seconds components are set to zero, resulting in an interval of exactly 15 hours.

```sql
   date_trunc
-----------------
 15:00:00.000000
```

### [](#truncate-to-quarter-interval)Truncate to quarter (interval)

This query truncates the interval **“16 years 4 months”** to the quarter-year level.

```sql
select DATE_TRUNC('quarter', '16 years 4 months'::interval);
```

The interval is truncated to the nearest quarter-year unit. The months component is adjusted to the start of the quarter. Since each quarter consists of 3 months, 4 months is truncated down to 3 months, resulting in:

```sql
   date_trunc
-----------------
 16 years 3 mons
```