时间差函数
<code>function tranTime($time) { $rtime = date("m-d H:i", $time); $htime = date("H:i", $time); $time = time() - $time; if ($time </code>
倒计时天数小时分秒函数
<code>function get_countdown($unix_time = '') { if (empty($unix_time)) return false; if ($unix_time 0, "hour" => 0, "min" => 0, "sec" => 0); $timediff = $unix_time - time(); $days = intval($timediff / 86400); // 时间差算整天数 $remain = $timediff % 86400; //整除天数取余,余下来秒数 记作 A $hours = intval($remain / 3600); // 用A除3600 算整小时数 $remain = $remain % 3600; //用A整除小时取余数 记作B $mins = intval($remain / 60); // 用B除60算整分数 $secs = $remain % 60; // 用B整数分取余数 为剩下的秒数 $res = array("day" => $days, "hour" => $hours, "min" => $mins, "sec" => $secs); return $res; } </code>
以上就介绍了php时间函数,即拿即用,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。