Skip to content

Instantly share code, notes, and snippets.

@feedhenry-gists
Created June 10, 2011 14:15
Show Gist options
  • Save feedhenry-gists/1018908 to your computer and use it in GitHub Desktop.
Save feedhenry-gists/1018908 to your computer and use it in GitHub Desktop.
Current Date/Time Cache Client Version
<p> Current Time : </p>
<div id="current_time_response"> </div>
<button id='current_time'> Refresh time </button>
<script>
$(document).ready(function(){
$('#current_time').click(readTime);
});
function readTime() {
// Read the current time from a new Date object
var time = new Date().toString();
// Display the time in-app using jQuery
$('#current_time_response').html(time);
}
// Do an initial read of the current time
readTime();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment