Convert Hours Minutes Seconds to Seconds Script

Convert Hours Minutes Seconds to Seconds Script is used to converts an hours minutes seconds to seconds.

Demo :



  Hours Minutes Seconds
 

Example :

Type : 23:11:11

Following code is convert hours minutes seconds to seconds Script core if you need copy and use to your website.


<?php
  $seconds='01:01:01';
  $str_time = preg_replace("/^([\d]{1,2})\:([\d]{2})$/", "00:$1:$2",$seconds);
  sscanf($str_time, "%d:%d:%d", $hours, $minutes, $seconds);
  echo $houres_seconds_minutes = (($hours * 3600 + $minutes * 60 + $seconds));
?>

In the above code convert from hours minutes seconds to seconds. The preg_replace() function convert time from seconds after sscanf function split hours second minutes from time. The hours multiple into 3600 to convert for the seconds and minutes multiple into 60 to convert for the seconds.

Free Download Script :

If you need convert hours minutes seconds to seconds Script click and download from following link.

Download