Skip to content

Instantly share code, notes, and snippets.

@luckyshot
Created July 24, 2014 08:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luckyshot/109db57429ad21054869 to your computer and use it in GitHub Desktop.
Save luckyshot/109db57429ad21054869 to your computer and use it in GitHub Desktop.
Seconds to Time Given the number of seconds it returns the value in minutes and seconds (i.e. 62 seconds returns 1:02)
/**
* secsToTime
* Given the number of seconds it returns the value in minutes and seconds
* (i.e. 62 seconds returns 1:02)
*/
function secsToTime(secs) {
return (secs / 60).toFixed() +':'+ ('0'+secs % 60).slice(-2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment