Hello all!
One of my MySQL queries is returning a value of time passed in this format
132:54:22
hrs:min:seconds
I would like to format this in the following manner on the page
132hrs 54mins
I wouldn’t think any of the date or time functions would work well. Any ideas what direction I should head?
Thanks in advanced for any guidance!
list($h, $m, $s) = explode(":", "132:54:22");
echo $h . "hrs " . $m . "mins ";
explode()
If the example was 132:54:30 and the desired result would be 132hrs 55mins, then a little bit of math will be needed.
explode is what I was looking at as well, just wasn’t sure it was the best way. Got it in the script and everything works great! I also slapped a number_format on the end result of the explode to rid the hours of leading 0’s.