作者:詹詹洋zy_431 | 来源:互联网 | 2018-07-17 00:40
ec(2);时间转换成秒数*时间转换成秒数,类似时间戳 *@paramstring$time *@returnint * publicstaticfunctiontimeToSec($time){ $pexplode(:,$time); $ccou
时间转换成秒数 * 时间转换成秒数,类似时间戳
* @param string $time
* @return int
*/
public static function timeToSec($time) {
$p = explode(':',$time);
$c = count($p);
if ($c>1) {
$hour = intval($p[0]);
$minute = intval($p[1]);
$sec = intval($p[2]);
} else {
throw new Exception('error time format');
}
$secs = $hour*3600 + $minute*60 + $sec;
return $secs;
}