PHP

How to convert seconds into hours, minutes, and seconds in PHP | PHP programs

How to convert seconds into hours, minutes, and seconds in PHP | PHP programs

How to convert seconds into hours, minutes, and seconds in PHP | PHP programs

We will convert the number of seconds into hours, minutes, and seconds.

<?php

$seconds = 6530;

$secs = $seconds % 60;
$hrs = $seconds / 60;
$mins = $hrs % 60;

$hrs = $hrs / 60;

print ("HH:MM:SS-> " . (int)$hrs . ":" . (int)$mins . ":" . (int)$secs);

?>
TutorialsLink Curator

This is an official account managed by the team TutorialsLink Community