MySQL TIME_TO_SEC is one of the Date Functions, which converts and returns the Time argument into seconds. In this article, we show you how to use this one to convert time to seconds from an expression with an example. The basic syntax of the Time_to_sec function is as shown below:
TIME_TO_SEC(Time);
MySQL TIME_TO_SEC function Example
The following examples help you understand the use of Time to the Second method. In this MySQL example, we are using different time values as input for this. Also, read about the MySQL SEC_TO_TIME function.
SELECT TIME_TO_SEC('10:22:30');
SELECT TIME_TO_SEC('01:00:00');
SELECT TIME_TO_SEC('23:59:59');

Let us see another Date method example of the Time to second. Here, we are using NOW, SYSDATE, and UTC_TIME inside this TIME_TO_SEC method.
TIP: Please refer to the MySQL TIMEDIFF and MySQL TIME functions from the list of available MySQL Date functions.
SELECT TIME_TO_SEC(NOW());
SELECT TIME_TO_SEC(SYSDATE());
SELECT TIME_TO_SEC(UTC_TIME);
