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.
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.
This query truncates the interval “16 years 4 months” to the quarter-year level.
Copy
Ask AI
select DATE_TRUNC('quarter', '16 years 4 months'::interval);
The interval is truncated to the nearest quarter-year unit.
The months components 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: