note 63396 deleted from function.mktime by bjori
| From: | bjori@php.net | Date: | Thu, 01 Jun 2006 18:37:13 +0000 |
| Subject: | note 63396 deleted from function.mktime by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-112805@lists.php.net to get a copy of this message | ||
Note Submitter: falstaff at arragon dot biz
----
To compliment the function by espinafre at gmail dot com. I also do various maths and comparisons on
the length of time between two events and I use this function to convert a H:M:S string (such as
found in a mySql time datatype) into the number of seconds.
<?php
//convert string "H:M:S" to seconds
function HMS_to_seconds($hms){
list($hour, $minute, $second) = sscanf($hms, "%d:%d:%d");
$seconds=$hour*60*60; //seconds in the hour
$seconds+=$minute*60; //seconds in the minute
$seconds+=$second;
return $seconds;
}
?>