Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.