我在变量中有259201 seconds
。
如何在"normally"
4 days 00:00:01
时间内对其进行转换?
提前谢谢!
答案 0 :(得分:2)
在PHP中执行此操作非常简单:
<?php
$secs = "259201";
$days = gmdate("d", $secs);
$hoursminssecs = gmdate("H:i:s", $secs);
if ($days == 0) { $days = empty($days); } elseif ($days == "1") { $days = "1 day"; } else { $days = $days." days"; }
echo $days." - ".$hoursminssecs
?>
希望它可以帮到你!