115
rated 0 times
[
118]
[
3]
/ answers: 1 / hits: 32006
/ 12 Years ago, mon, may 14, 2012, 12:00:00
I'm trying to find out how I can display dynamic date and time using moment.js.
Apparently I can't figure out to use setInterval properly.
If possible I'd prefer not to use jQuery as moment.js dosn't need it.
Here's what I have so far: http://jsfiddle.net/37fLF/2/.
$(document).ready(function () {
var datetime = $('#datetime'),
date = moment(new Date()),
update = function(){
datetime.html(date.format('dddd, MMMM Do YYYY, h:mm:ss a'));
};
update();
setInterval(update, 1000);
});
More From » jquery