📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

TO_QUARTER



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 │ └─────────────────────────────────────────────────────────────────┘

Was this page helpful?