Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="clock">UHRZEIT!</div>
- <script>
- function setTime(){
- var d = new Date();
- var hours = d.getHours();
- if (hours.toString().length < 2){
- hours = "0" + hours;
- }
- var minutes = d.getMinutes();
- if (minutes.toString().length < 2){
- minutes = "0" + minutes;
- }
- var seconds = d.getSeconds();
- if (seconds.toString().length < 2){
- seconds = "0" + seconds;
- }
- document.getElementById("clock").innerHTML = hours+":"+minutes+":"+seconds;
- }
- setInterval(setTime,100);
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement