Created
February 9, 2014 18:24
-
-
Save mallendeo/8903575 to your computer and use it in GitHub Desktop.
Simple Momentjs clock
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
// include jquery, momentjs | |
$(function () { | |
var m = moment(); | |
var updateClock = function(){ | |
var hour = m.hour() < 10 ? '0'+m.hour() : m.hour(), | |
minute = m.minute() < 10 ? '0'+m.minute() : m.minute(); | |
$('#clock').text(hour+':'+minute); | |
} | |
updateClock(); | |
setInterval(updateClock, 60000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment