MariaDB: SEC_TO_TIME Function
This MariaDB tutorial explains how to use the MariaDB SEC_TO_TIME function with syntax and examples.
Description
The MariaDB SEC_TO_TIME function converts numeric seconds into a time value.
Syntax
The syntax for the SEC_TO_TIME function in MariaDB is:
SEC_TO_TIME( seconds )
Parameters or Arguments
- seconds
- A numeric value representing the number of seconds. This value can be positive or negative.
Note
- Time values range from '-838:59:59' to '838:59:59'.
- The SEC_TO_TIME function will format the result as "HH:MM:SS".
- See also the TIME_TO_SEC function.
Applies To
The SEC_TO_TIME function can be used in the following versions of MariaDB:
- MariaDB 10
Example
Let's look at some MariaDB SEC_TO_TIME function examples and explore how to use the SEC_TO_TIME function in MariaDB.
For example:
SELECT SEC_TO_TIME(1); Result: '00:00:01' SELECT SEC_TO_TIME(2); Result: '00:00:02' SELECT SEC_TO_TIME(999); Result: '00:16:39' SELECT SEC_TO_TIME(18700); Result: '05:11:40' SELECT SEC_TO_TIME(-18700); Result: '-05:11:40'
Advertisements