Skip to content

Converts a specified number of hours into an Interval type.

  • Accepts positive integers, zero, and negative integers as input.
func.to_hours(<hours>)
func.to_hours(2)
┌──────────────────────────────────────────────────────┐
│ func.to_hours(2) │
├──────────────────────────────────────────────────────┤
2:00:00
└──────────────────────────────────────────────────────┘
TO_HOURS(<hours>)

Interval (in the format hh:mm:ss).

SELECT TO_HOURS(2), TO_HOURS(0), TO_HOURS((- 2));
┌───────────────────────────────────────────┐
│ to_hours(2) │ to_hours(0) │ to_hours(- 2) │
├─────────────┼─────────────┼───────────────┤
2:00:0000:00:00-2:00:00
└───────────────────────────────────────────┘