php计算多少小时多少分钟多少秒

原创
2019/07/24 09:09
阅读数 74

	//计算小时数
	$timediff =1563928200 - 1563925800;
	$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);
	if($hours){$hours = "{$hours}时";}else{ $hours='';}
        if($mins){  $mins = "{$mins}分";}else{ $mins='';}
        if($secs){  $secs = "{$secs}秒";}else{ $secs='';}
        $replaytime = $hours.$mins.$secs;
        echo $replaytime;
	exit;

 

展开阅读全文
PHP
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部