Created
December 15, 2014 18:11
-
-
Save sscotth/c7ba00301eea3db21aa2 to your computer and use it in GitHub Desktop.
Display Timer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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