function timediff($begin_time,$end_time)
{
if($begin_time < $end_time){
$starttime = $begin_time;
$endtime = $end_time;
}
else{
$starttime = $end_time;
$endtime = $begin_time;
}
$timediff = $endtime-$starttime;
$days = intval($timediff/86400);
$remain = $timediff%86400;
$hours = intval($remain/3600);
$remain = $remain%3600;
$mins = intval($remain/60);
$secs = $remain%60;
$res = array("day" => $days,”hour” => $hours,”min” => $mins,”sec” => $secs);
return $res;
}
php计算两个时间差并返回差多少天、时、分、秒
未经允许不得转载:PHP技术博客 » php计算两个时间差并返回差多少天、时、分、秒
相关推荐
- WordPress替换编辑文章默认的“在此输入标题”文本
- 在WordPress代码内如何禁用自动格式化
- 利用PHPMailer发送邮件时报错:Failed to connect to server: Unable to find the socket transport “ssl” – did you forget to enable it when you configured PHP
- php网站被挂木马如何修复
- android studio运行失败,然后检测java出现:could not open `D:\jdk\lib\i386\jvm.cfg’
- thinkphp视图模型查询失败提示:ERR: 1146:Table ‘db.pr_order_view’ doesn’t exist
- php利用淘宝IP库获取用户ip地理位置
- 帝国cmsloop标签调用图文