I want only hour minutes and seconds from seconds
Answers
-
if (!function_exists('secondsToTime')) { function secondsToTime($seconds_time = 0){ if(is_numeric($seconds_time) && $seconds_time > 0){ $seconds_time = (int)$seconds_time; $remainder_m = $seconds_time % 3600; $hours = ($seconds_time - $remainder_m) / 3600; $remainder_s = $remainder_m % 60; $minutes = ($remainder_m - $remainder_s) / 60; $seconds = $remainder_s; $hours = str_pad($hours, 2, "0", STR_PAD_LEFT ); $minutes = str_pad($minutes, 2, "0", STR_PAD_LEFT ); $seconds = str_pad($seconds, 2, "0", STR_PAD_LEFT ); return "$hours:$minutes:$seconds"; }else{ return "00:00:00"; } } }
echo secondsToTime(96528);
will give26:48:48
0
Howdy, Stranger!
Categories
- 94 All Categories
- 20 VoIP
- 7 SIP
- 16 asterisk
- 44 Programming
- 1 Nodejs
- 4 javascript
- 19 PHP
- 8 Codeigniter
- 14 database
- 1 UI/UX
- 2 Flutter
- 28 OS
- 26 Linux
- 1 Virtualization
- 1 Android
- 1 Windows
- 2 legal