Skip to content

Instantly share code, notes, and snippets.

@sscotth
Created December 15, 2014 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sscotth/c7ba00301eea3db21aa2 to your computer and use it in GitHub Desktop.
Save sscotth/c7ba00301eea3db21aa2 to your computer and use it in GitHub Desktop.
Display Timer
var beginTime = new Date()
function displayTimer(){
var secondsSinceBegin = moment.duration( Date.now() - beginTime ).asSeconds();
var formatAsTimer = moment().hour(0).minute(0).second(secondsSinceBegin).format('H:mm:ss');
console.log(formatAsTimer);
}
setInterval(displayTimer, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment