i am trying to create a script that can update the current time automatically in the datetime-local input without having to click and selecting the current time. this is the code that i am working with to have the input display the current date and time, but i also want it to update the current time when the time changes.
then i hope to submit the datetime-local value to the database using PHP (i got this section covered)
and i was hoping if it's possible to delete the date and time selection button in the input and how can i show the seconds, but have the seconds running accurately with current time
thank you all.
var now = new Date();
now.setMinutes(now.getMinutes() - now.getTimezoneOffset());
document.getElementById('dt').value = now.toISOString().slice(0,16);
<input id="dt" type="datetime-local" />