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.743133 │ 1 │ 1 │
└─────────────────────────────────────────────────────────────────┘
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today