Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@fradaloisio
Forked from anonymous/index.html
Created October 10, 2017 22:31
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 fradaloisio/5e9c9c90b0bdf67e3ca89e40fb0f7ffc to your computer and use it in GitHub Desktop.
Save fradaloisio/5e9c9c90b0bdf67e3ca89e40fb0f7ffc to your computer and use it in GitHub Desktop.
Ticking Clock
<div id="clock"></div>
<div id="utc"></div>
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
function clock(){
var today = new Date;
// var hours = today.getHours();
// var minutes = today.getMinutes();
// var seconds = today.getSeconds();
// if (hours<10){
// hours = "0" + hours;
// }
// if (minutes<10){
// minutes = "0" + minutes;
// }
// else {
// minutes = minutes;
// }
// if (seconds<10){
// seconds = "0" + seconds;
// }
// else {
// seconds = seconds;
// }
// document.getElementById("clock").innerHTML = (hours + ":" + minutes + ":" + seconds);
var utc_time = today.toUTCString();
document.getElementById("utc").innerHTML = (utc_time);
}
setInterval('clock()', 1000);
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
body {
background: #333;
color: white;
}
#clock,#utc {
text-align: center;
margin-top: 10%;
font-size: 4em;
font-family: 'Lato', sans-serif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment