date_trunc
Round a date or timestamp down to the start of a unit such as month or year. Also available as datetrunc.
Try an expression
In Formula, enter the expression and set Output type to TIMESTAMP.
Expression
date_trunc('month', DATE '1992-03-07')Result
1992-03-01 00:00:00To use your own data, replace the example values with column names. Keep format strings and other options as written.
Arguments and types
date_trunc(part, timestamp)- part
- Text
- timestamp
- Date, Interval, Timestamp
Supported signatures (4)
date_trunc(part: VARCHAR, timestamp: DATE) → TIMESTAMP
date_trunc(part: VARCHAR, timestamp: INTERVAL) → INTERVAL
date_trunc(part: VARCHAR, timestamp: TIMESTAMP WITH TIME ZONE) → TIMESTAMP WITH TIME ZONE
date_trunc(part: VARCHAR, timestamp: TIMESTAMP) → TIMESTAMPThe result type can depend on the input types. See DuckDB for the full argument rules.
Things to know
If the first argument is missing, the result is NULL.
Function metadata from DuckDB, used under the MIT license.