time_to_sec
Converts a time value into the number of seconds. The formula used for the conversion is as follows:
Hour x 3600 + Minute x 60 + Second
Syntaxβ
BIGINT time_to_sec(TIME time)
Parametersβ
time
: It must be of the TIME type.
Return valueβ
Returns a value of the BIGINT type. If the input is invalid, NULL is returned.
Examplesβ
select time_to_sec('12:13:14');
+-----------------------------+
| time_to_sec('12:13:14') |
+-----------------------------+
| 43994|
+-----------------------------+