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:02 │ 00:00:00 │ -0:00:02 │
└─────────────────────────────────────────────────┘
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