时间:2021-07-01 10:21:17 帮助过:19人阅读
/**
* 计算两个时间戳之差
* @param $begin_time
* @param $end_time
* @return array
*/functiontimeDiff( $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 );
Log::info($res);
return$res;
}
').addClass('pre-numbering').hide();
$(this).addClass('has-numbering').parent().append($numbering);
for (i = 1; i <= lines; i++) {
$numbering.append($('').text(i));
};
$numbering.fadeIn(1700);
});
});
以上就介绍了PHP计算两个时间戳之差,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。