1
<input type="date" name="today" id="today" value="Date()">

i have done this but this does'nt work I want that the input should display the current date

  • 3
    Does this answer your question? [How to set input type date's default value to today?](https://stackoverflow.com/questions/6982692/how-to-set-input-type-dates-default-value-to-today) – Robin Mollah Jun 20 '21 at 08:24
  • that is because of format for sure – AnaCS Jun 20 '21 at 08:35

1 Answers1

2

You can also use JS Date() Object:

document.getElementById('date').valueAsDate = new Date();
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<input type='date' id='date'>
</body>
</html>
NcXNaV
  • 1,657
  • 4
  • 14
  • 23