我可以将int转换为天,小时,分钟和秒,但是反转它并转换回秒的计算是什么?
这是我第一次转换的内容:
<?php
$seconds = 12345;
$days = floor ($seconds / 60 / 60 / 24);
$hours = floor ($seconds / 60 / 60) % 24;
$minutes = floor ($seconds / 60) % 60;
$seconds = $seconds % 60;
?>
答案 0 :(得分:1)
$total = ($days * 24 * 60 * 60) + ($hours * 60 * 60) + ($minutes * 60) + $seconds;
答案 1 :(得分:0)
试试这个
$total = ($days * 24 * 60 * 60) + ($hours * 60 * 60) + ($minutes * 60) + $seconds;