时间转换成秒数,类似时间戳
<?php 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; }
文章地址:http://www.phprm.com/code/70a38829d3c102f3a7fe3ccb3fe841d0.html
转载随意^^请带上本文地址!