+ 1

How to create a digital clock

21st Jan 2018, 1:24 PM
Gautam Kumar
Gautam Kumar - avatar
2 Answers
+ 7
Use the following code: <h2 id="clock"></h2> <script type="text/javascript"> var clock=document.getElementById("clock"); setInterval(function(){ var time=new Date(); clock.innerHTML=time.getHours()+":"+time.getMinutes()+":"+time.getSeconds(); },1000) </script>
21st Jan 2018, 1:34 PM
Adnan Zawad Toky
Adnan Zawad Toky - avatar
21st Jan 2018, 2:48 PM
Md. Nafis Ul Haque Shifat
Md. Nafis Ul Haque Shifat - avatar