TO_MONTH (Lakehouse v1)
Convert a date or date with time (timestamp/datetime) to a UInt8 number containing the month number (1-12).
Analyze Syntax
Section titled “Analyze Syntax”func.to_month(<expr>)Analyze Examples
Section titled “Analyze Examples”func.now(), func.to_month(func.now()), func.month(func.now())
┌─────────────────────────────────────────────────────────────────────────────────┐│ func.now() │ func.to_month(func.now()) │ func.month(func.now()) │├────────────────────────────┼───────────────────────────┼────────────────────────┤│ 2024-03-14 23:34:02.161291 │ 3 │ 3 │└─────────────────────────────────────────────────────────────────────────────────┘SQL Syntax
Section titled “SQL Syntax”TO_MONTH(<expr>)Arguments
Section titled “Arguments”| Arguments | Description |
|---|---|
<expr> | date/timestamp |
Aliases
Section titled “Aliases”Return Type
Section titled “Return Type”TINYINT
SQL Examples
Section titled “SQL Examples”SELECT NOW(), TO_MONTH(NOW()), MONTH(NOW());
┌─────────────────────────────────────────────────────────────┐│ now() │ to_month(now()) │ month(now()) │├────────────────────────────┼─────────────────┼──────────────┤│ 2024-03-14 23:34:02.161291 │ 3 │ 3 │└─────────────────────────────────────────────────────────────┘