Skip to content

Instantly share code, notes, and snippets.

@ekinoguz
Created May 14, 2013 10:57
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 ekinoguz/5575146 to your computer and use it in GitHub Desktop.
Save ekinoguz/5575146 to your computer and use it in GitHub Desktop.
Auto-updated timer, without refreshing the webpage.
<html>
<head>
<script type="text/javascript">
function time_updated(){
// Refresh rate in milliseconds
var refresh=1000;
setTimeout('time()',refresh);
}
function time() {
var beginning = new Date(2013, 1, 1);
var now = new Date();
document.getElementById('out').innerHTML = (now-beginning);
time_updated();
}
</script>
</head>
<body onload=time();>
<span id='out'></span></br>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment