TIME_TO_SEC()
TIME_TO_SEC(time)This function returns the number of seconds that the given time represents. It’s the inverse of SEC_TO_TIME(). Here is an example:
SELECT TIME_TO_SEC('01:00')
AS 'Seconds to 1 a.m.';
+-------------------+
| Seconds to 1 a.m. |
+-------------------+
| 3600 |
+-------------------+Here, we calculate the number of seconds up until 1 A.M. (i.e., 60 seconds times 60 minutes), or one hour into the day.