Skip to main content

TO_HOURS

Introduced or updated: v1.2.677

Converts a specified number of hours into an Interval type.

  • Accepts positive integers, zero, and negative integers as input.

Syntax

TO_HOURS(<hours>)

Return Type

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

Examples

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
└───────────────────────────────────────────┘
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today