Show or print the current time using javascript in your web Page.

Shivam Abraham
Jun 19, 2021

— create an element with id or class in your html as i have added one <p> tag with id ‘demo’.

html paragraph tag with id of demo| Shivam Abraham| Mr Abraham
HTML element with the id

— Set an interval method to call a function at given interval

— Create an function.

— Select the date by the new Date() method.

— Convert the date into local time string.

— Select the element by the id or class and add the innerhtml for the time variable

— to select the element use document.getElementByClassName(‘ class name’) .

Javascript function or setinterval methood| Shivam Abraham | Mr Abtaham
Javascript to show the time

--

--

Shivam Abraham

Web Developer ! Frontend Dev ! HTML , CSS, JAVASCRIPT !