I have time in minutes and I want to find out how many hours it is. But with attached code, for 1600 minutes, I get 2 hours and 40 minutes. I need it in format 26:40:00. Thanks for help.
$my_time = 1600;
echo date("H:i:s", $my_time);
Try using a DateInterval
object, which is specifically built to handle intervals of time:
$interval = new DateInterval('M1600');
echo $interval->format('%H:%i:%s');
date
isn't really suited for this. Instead, try this:
echo sprintf("%s:%2s:%2s",floor($my_time/3600),floor($my_time/60)%60,$my_time%60);
(This is assuming you have $my_time
in seconds, not minutes. Multiply by 60
up front to get the time in seconds)