MariaDB: TIME_TO_SEC Function
This MariaDB tutorial explains how to use the MariaDB TIME_TO_SEC function with syntax and examples.
Description
The MariaDB TIME_TO_SEC function converts a time value into numeric seconds.
Syntax
The syntax for the TIME_TO_SEC function in MariaDB is:
TIME_TO_SEC( time )
Parameters or Arguments
- time
- The time value to convert to numeric seconds.
Note
- See also the SEC_TO_TIME function.
Applies To
The TIME_TO_SEC function can be used in the following versions of MariaDB:
- MariaDB 10
Example
Let's look at some MariaDB TIME_TO_SEC function examples and explore how to use the TIME_TO_SEC function in MariaDB.
For example:
SELECT TIME_TO_SEC('00:00:01'); Result: 1 SELECT TIME_TO_SEC('00:00:01.999999'); Result: 1 SELECT TIME_TO_SEC('00:00:02'); Result: 2 SELECT TIME_TO_SEC('00:10:14'); Result: 614 SELECT TIME_TO_SEC('12:30:59'); Result: 45059 SELECT TIME_TO_SEC('-12:30:59'); Result: -45059
Advertisements