Converts a TIME value to the total number of seconds. The inverse of SEC_TO_TIME().
INTDiperbarui: 13 Jun 2026TIME_TO_SEC(time)The time value to convert
1 SELECT TIME_TO_SEC('01:30:00') AS seconds;
1 hour 30 minutes equals 5400 seconds.
1 SELECT SUM(TIME_TO_SEC(duration)) AS total_seconds, 2 SEC_TO_TIME(SUM(TIME_TO_SEC(duration))) AS total_time 3 FROM work_logs;
Sum durations and convert back to time format.
1 SELECT * 2 FROM tasks 3 WHERE TIME_TO_SEC(duration) > 3600;
Filter tasks longer than 1 hour.
Sudah paham TIME_TO_SEC? Latih langsung di browser
Latihan interaktif, langsung di browser.