Last active
October 16, 2021 11:49
-
-
Save pawelel/f0f855f5cf944c7fd4dbdf3bad9a60a0 to your computer and use it in GitHub Desktop.
Simple clock in html with JS
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
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>clock</title> | |
<script> | |
function counting() { | |
"use strict"; | |
var today = new Date(), | |
day = today.getDay(), | |
month = today.getMonth() + 1, | |
year = today.getFullYear(), | |
hour = today.getHours(), | |
minute = today.getMinutes(), | |
second = today.getSeconds(); | |
setTimeout(counting(), 1000); | |
} | |
</script> | |
</head> | |
<body onload="counting();"> | |
<div id="clock"></div> | |
<script> | |
document.getElementById("clock").innerHTML = day+"/"+month+"/"+year+" |"+hour+":"+minute+":"+second; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment