Skip to content
Advertisement

input “datetime-local” > js code that makes the seconds run/move accurately for time to update

I would like to find out how to have the seconds run/move accurately for the time to change. is there a way I can do that with the js script that I have provided below?

thank you all.

JavaScript
JavaScript

Advertisement

Answer

Using getSeconds and setSeconds works:

I also changed the string slice to .slice(0,19) to show the updated seconds.

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement