sanjay555

Untitled

Oct 27th, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function updateClock() {
  2.     let now = new Date();
  3.     let milli = now.getMilliseconds();
  4.     let sec = now.getSeconds();
  5.     let min = now.getMinutes();
  6.     let hr = now.getHours();
  7.     let mm = now.getMonth();
  8.     let dy = now.getDate();
  9.     let yyyy = now.getFullYear();
  10. //     console.log(`${dy}:${mm}:${yyyy}:${hr}:${mm}:${sec}:${milli}:`)
  11.     document.body.style.background = "white";
  12.     document.body.innerHTML = `<h1>${dy}:${mm}:${yyyy}:${hr}:${mm}:${sec}:${milli}</h1>`
  13. }
  14.  
  15. function initialClock() {
  16.     updateClock();
  17.     window.setInterval(updateClock, 1)
  18.  
  19. }
  20. initialClock();
Add Comment
Please, Sign In to add comment