note 63396 added to function.mktime
| From: | falstaff at arragon dot biz | Date: | Wed, 22 Mar 2006 01:21:55 +0000 |
| Subject: | note 63396 added to function.mktime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-106188@lists.php.net to get a copy of this message | ||
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;
}
?>
----
Server IP: 66.163.161.117
Probable Submitter: 72.160.42.119
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.mktime.php
Edit -- http://master.php.net/note/edit/63396
Del: integrated -- http://master.php.net/note/delete/63396/integrated
Del: useless -- http://master.php.net/note/delete/63396/useless
Del: bad code -- http://master.php.net/note/delete/63396/bad+code
Del: spam -- http://master.php.net/note/delete/63396/spam
Del: non-english -- http://master.php.net/note/delete/63396/non-english
Del: in docs -- http://master.php.net/note/delete/63396/in+docs
Del: other reasons-- http://master.php.net/note/delete/63396
Reject -- http://master.php.net/note/reject/63396
Search -- http://master.php.net/manage/user-notes.php