MySQL TIME_TO_SEC Function

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 second from an expression with an example. The basic syntax of the Time_to_second is as shown below:

TIME_TO_SEC(Time);

MySQL TIME_TO_SEC function Example

The following examples help you understand the use of the Time to the Second method. In this MySQL example, we are using different time values as an input for this.

SELECT TIME_TO_SEC('10:22:30');

SELECT TIME_TO_SEC('01:00:00');

SELECT TIME_TO_SEC('23:59:59');
TIME TO SECOND Example 1

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.

SELECT TIME_TO_SEC(NOW());

SELECT TIME_TO_SEC(SYSDATE());

SELECT TIME_TO_SEC(UTC_TIME);
TIME_TO_SEC Example 2