php - Milliseconds conversion to basic time -
i need convert 1774132
30:42 or 30 minutes , 42 seconds or whatever output of is. there php function this?
i found online long time ago, have no idea anymore:
<?php function secondstowords($seconds) { /*** return value ***/ $ret = ""; /*** hours ***/ $hours = intval(intval($seconds) / 3600); if($hours > 0) { $ret .= "$hours hours "; } /*** minutes ***/ $minutes = bcmod((intval($seconds) / 60),60); if($hours > 0 || $minutes > 0) { $ret .= "$minutes minutes "; } /*** seconds ***/ $seconds = bcmod(intval($seconds),60); $ret .= "$seconds seconds"; return $ret; } echo secondstowords(time()); ?>
Comments
Post a Comment