/ Published in: ActionScript 3

A quick and easy function to convert seconds into easily readable time.
(90 seconds = 01:30)
(90 seconds = 01:30)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
private function convertTime(secs:Number):String { var h:Number=Math.floor(secs/3600); var m:Number=Math.floor((secs%3600)/60); var s:Number=Math.floor((secs%3600)%60); return(h==0?"":(h<10?"0"+h.toString()+":":h.toString()+":"))+(m<10?"0"+m.toString():m.toString())+":"+(s<10?"0"+s.toString():s.toString()); }
Comments
