Date methods of date object in JS | Sololearn: Learn to code for FREE!

0

Date methods of date object in JS

function printTime() { var d = new Date(); var hours = d.getHours(); var mins = d.getMinutes(); var secs = d.getSeconds(); document.body.innerHTML = hours+":"+mins+":"+secs; } setInterval(printTime, 1000); How can I print the current time once every second to my laptop screen. Please care to expand. Thanks in advance.

8/6/2018 1:12:08 PM

kp kalia

1 Answer

New Answer

0

Laptop screen? Did you mean browser screen in fact?