Home »
MySQL »
MySQL date/time Functions
MySQL TIME_TO_SEC() Function
MySQL | TIME_TO_SEC() Function: Learn about the TIME_TO_SEC() function, how it works, its usages, syntax, and examples.
Submitted by Apurva Mathur, on October 12, 2022
TIME_TO_SEC() Function
As the name suggests, the TIME_TO_SEC() function is used to convert the given argument (time) into seconds.
TIME_TO_SEC() Syntax
SELECT TIME_TO_SEC(time);
TIME_TO_SEC() Parameter(s)
As a parameter, you only have to provide the time at which you want to convert.
TIME_TO_SEC() Return Value
It will return you the seconds after converting it from the time that you have provided.
MySQL TIME_TO_SEC() Function Example 1
SELECT TIME_TO_SEC("10:12:09");
MySQL TIME_TO_SEC() Function Example 2
SELECT TIME_TO_SEC("11:12:19.009");
MySQL TIME_TO_SEC() Function Example 3
SELECT TIME_TO_SEC("10:10:10.00005");