📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

TO_HOURS



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 │ └───────────────────────────────────────────┘

Was this page helpful?