//计算工作时间
$work_time_sum = 0;
if($user_work){
foreach ($user_work as $k => $v) {
if(!$v['edate']){
$v['edate'] = time();
}
$second = $v['edate']-$v['sdate'];;
$year = floor($second/3600/24/365); //从这个时间戳中换算出年头数
$temp =$second-$year*365*24*3600;
$month=floor($temp/3600/24/30); //从这个时间戳中共换算出月数
$str = '';
if($year){
$str .= $year.'年';
}
$str .= $month.'个月';
$user_work[$k]['wort_time'] = $str;
$work_time_sum = $work_time_sum+$second;
}
$year = floor($work_time_sum/3600/24/365); //从这个时间戳中换算出年头数
$temp =$work_time_sum-$year*365*24*3600;
$month=floor($temp/3600/24/30); //从这个时间戳中共换算出月数
$work_time_sum = '';
if($year){
$work_time_sum .= $year.'年';
}
$work_time_sum .= $month.'个月';
}
时间戳 计算 工作时间
最新推荐文章于 2023-01-02 16:48:01 发布