Write a PHP script to convert seconds into days, hours, minutes and seconds
- برمجة بي اتش بي
- 2021-09-09
- mhanasmh00489829403
الأجوبة
<?php
function convert_seconds($seconds)
{
$dt1 = new DateTime("@0");
$dt2 = new DateTime("@$seconds");
return $dt1->diff($dt2)->format('%a days, %h hours, %i minutes and %s seconds');
}
echo convert_seconds(200000)."\n";
?>
Sample Output:
2 days, 7 hours, 33 minutes and 20 seconds
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال