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