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:00 │ 00:00:00 │ -2:00:00 │
└───────────────────────────────────────────┘
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today