Skip to main content

TO_SECONDS

Introduced or updated: v1.2.677

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