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

— 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’) .

Shivam Abraham

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store