Skip to content

Instantly share code, notes, and snippets.

@larzconwell
Created May 18, 2012 21:51
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 larzconwell/2727785 to your computer and use it in GitHub Desktop.
Save larzconwell/2727785 to your computer and use it in GitHub Desktop.
disp_date = function(obj) {
if(obj <= 0) return;
var date = new Date()
, tillNextDay = (24 - date.getHours()) * 3600000
, waitLoop
, dateLoop;
obj.html(current_date());
waitLoop = setTimeout(function() {
clearTimeout(waitLoop);
obj.html(current_date());
dateLoop = setInterval(function() {
obj.html(current_date());
}, 86400000);
}, tillNextDay);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment