TO_QUARTER (Lakehouse v1)
Retrieves the quarter (1, 2, 3, or 4) from a given date or timestamp.
Analyze Syntax
Section titled “Analyze Syntax”func.to_quarter(<expr>)Analyze Examples
Section titled “Analyze Examples”func.now(), func.to_quarter(func.now()), func.quarter(func.now())
┌─────────────────────────────────────────────────────────────────────────────────────┐│ func.now() │ func.to_quarter(func.now()) │ func.quarter(func.now()) │├────────────────────────────┼─────────────────────────────┼──────────────────────────┤│ 2024-03-14 23:32:52.743133 │ 3 │ 3 │└─────────────────────────────────────────────────────────────────────────────────────┘SQL Syntax
Section titled “SQL Syntax”TO_QUARTER( <date_or_time_expr> )Aliases
Section titled “Aliases”Return Type
Section titled “Return Type”Integer.
SQL Examples
Section titled “SQL Examples”SELECT NOW(), TO_QUARTER(NOW()), QUARTER(NOW());
┌─────────────────────────────────────────────────────────────────┐│ now() │ to_quarter(now()) │ quarter(now()) │├────────────────────────────┼───────────────────┼────────────────┤│ 2024-03-14 23:32:52.743133 │ 1 │ 1 │└─────────────────────────────────────────────────────────────────┘