TO_MONTHS (Lakehouse v1)
Converts a specified number of months into an Interval type.
- Accepts positive integers, zero, and negative integers as input.
Analyze Syntax
Section titled “Analyze Syntax”func.to_months(<months>)Analyze Examples
Section titled “Analyze Examples”func.to_months(2)┌──────────────────────────────────────────────────────┐│ func.to_months(2) │├──────────────────────────────────────────────────────┤│ 2 months │└──────────────────────────────────────────────────────┘SQL Syntax
Section titled “SQL Syntax”TO_MONTHS(<months>)Return Type
Section titled “Return Type”Interval (represented in months).
SQL Examples
Section titled “SQL Examples”SELECT TO_MONTHS(2), TO_MONTHS(0), TO_MONTHS((- 2));
┌──────────────────────────────────────────────┐│ to_months(2) │ to_months(0) │ to_months(- 2) │├──────────────┼──────────────┼────────────────┤│ 2 months │ 00:00:00 │ -2 months │└──────────────────────────────────────────────┘