0

I have a time of H:i:s like 01:51:36 in my SQL table, how can we convert it to like the sum of time in seconds 01:51:36 = 110160 Seconds

My code:

SELECT * FROM tbl WHERE name = Time


while ($row = mysqli_fetch_array($result)) {


$Duration = date("%s seconds');", strtotime($row["audio_duration"]));

echo $Duration;

}

Results = %31 31UTC2022-08-08T00:02:31+00:00202280831');

Sahil
  • 55
  • 6
  • [TIME_TO_SEC(time)](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_time-to-sec) ? – Luuk Aug 08 '22 at 16:00
  • Or, when you want to do it in PHP, does this answer your question? [Convert time in HH:MM:SS format to seconds only?](https://stackoverflow.com/questions/4834202/convert-time-in-hhmmss-format-to-seconds-only) – Luuk Aug 08 '22 at 16:01
  • 110160 seconds is 30 hours 36 minutes, not 1:51:36?? – ysth Aug 08 '22 at 16:04
  • @Luuk no not any of following helped, please help me – Sahil Aug 08 '22 at 17:10
  • Can you make your code into a [mre] (one without syntax errors?) – Luuk Aug 08 '22 at 17:53

0 Answers0