daily pastebin goal
13%
SHARE
TWEET

UHR

a guest Dec 7th, 2017 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     <div id="clock">UHRZEIT!</div>
  2.     <script>
  3.         function setTime(){
  4.             var d = new Date();
  5.  
  6.             var hours = d.getHours();
  7.             if (hours.toString().length < 2){
  8.                 hours = "0" + hours;
  9.             }
  10.  
  11.             var minutes = d.getMinutes();
  12.             if (minutes.toString().length < 2){
  13.                 minutes = "0" + minutes;
  14.             }
  15.  
  16.             var seconds = d.getSeconds();
  17.             if (seconds.toString().length < 2){
  18.                 seconds = "0" + seconds;
  19.             }
  20.  
  21.             document.getElementById("clock").innerHTML = hours+":"+minutes+":"+seconds;
  22.         }
  23.         setInterval(setTime,100);
  24.     </script>
RAW Paste Data
Top