May 2005
Intermediate to advanced
352 pages
14h 39m
English
TIME_TO_SEC( )
TIME_TO_SEC(time)This
function returns the number of seconds that the given time
represents. This function is the inverse of SEC_TO_TIME().
SELECT TIME_TO_SEC('01:00')
AS 'Seconds up to 1 a.m.';
+----------------------+
| Seconds up to 1 a.m. |
+----------------------+
| 3600 |
+----------------------+Here we're calculating the number of seconds up until the time of 1 a.m. (i.e., 60 seconds times 60 minutes) or one hour into the day.
Read now
Unlock full access