Created
May 29, 2013 13:50
-
-
Save telekineticyeti/5670387 to your computer and use it in GitHub Desktop.
JQuery clock routine for adding a time/date element to the page that updates every second.
This file contains hidden or 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
/* | |
JQuery clock routine for adding a time/date element to the page that updates every second. | |
*/ | |
jQuery(document).ready(function(){ | |
jQuery.noConflict(); | |
function clockUpdate() { | |
var myDate = new Date(); | |
var displayDate = (myDate.getDate()) + '/' + (myDate.getMonth()+1) + '/' + myDate.getFullYear(); | |
var displayTime = (myDate.getHours()) + ':' + (myDate.getMinutes()<10?'0':'') + (myDate.getMinutes()) + ':' + (myDate.getSeconds∏()<10?'0':'') + (myDate.getSeconds()); | |
jQuery('.floatingClock .fcTime').text(displayTime); | |
jQuery('.floatingClock .fcDate').text(displayDate); | |
} | |
clockUpdate(); | |
floatingClock = setInterval (function() { | |
clockUpdate(); | |
}, 1000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment