Skip to main content

TO_QUARTER

Introduced or updated: v1.2.153

Retrieves the quarter (1, 2, 3, or 4) from a given date or timestamp.

Syntax

TO_QUARTER( <date_or_time_expr> )

Aliases

Return Type

Integer.

Examples

SELECT NOW(), TO_QUARTER(NOW()), QUARTER(NOW());

┌─────────────────────────────────────────────────────────────────┐
now() │ to_quarter(now()) │ quarter(now())
├────────────────────────────┼───────────────────┼────────────────┤
2024-03-14 23:32:52.74313311
└─────────────────────────────────────────────────────────────────┘
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today