Return to Snippet

Revision: 26648
at May 5, 2010 13:05 by cessnajumpin


Initial Code
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());
}

Initial URL

                                

Initial Description
A quick and easy function to convert seconds into easily readable time.
(90 seconds = 01:30)

Initial Title
ActionScript Seconds to Standard Time Format

Initial Tags
actionscript, script

Initial Language
ActionScript 3