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

TO_SECONDS



Converts a specified number of seconds into an Interval type.

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

Syntax

TO_SECONDS(<seconds>)

Aliases

Return Type

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

Examples

SELECT TO_SECONDS(2), TO_SECONDS(0), TO_SECONDS((- 2)); ┌─────────────────────────────────────────────────┐ │ to_seconds(2) │ to_seconds(0) │ to_seconds(- 2) │ ├───────────────┼───────────────┼─────────────────┤ │ 0:00:0200:00:00-0:00:02 │ └─────────────────────────────────────────────────┘

Was this page helpful?