Skip to content

Converts a specified number of seconds into an Interval type.

  • Accepts positive integers, zero, and negative integers as input.
func.to_seconds(<seconds>)
func.to_seconds(2)
┌──────────────────────────────────────────────────────┐
│ func.to_seconds(2) │
├──────────────────────────────────────────────────────┤
0:00:02
└──────────────────────────────────────────────────────┘
TO_SECONDS(<seconds>)

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

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