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> )

Return Type

Integer.

Examples

SELECT NOW();

now() |
---------------------+
2023-10-13 08:40:36.0|

SELECT TO_QUARTER(NOW());

to_quarter(now())|
-----------------+
4|

SELECT TO_QUARTER('2022-05-13');

to_quarter('2022-05-13')|
------------------------+
2|
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today