Computer >> Computer tutorials >  >> Programming >> HTML

How to use input type field with date field in HTML?


The <input type="date"> is for input fields with date. It allows to easily entering the date with day, month and year. You can get user input for birthday date, registration date, etc.

A datepicker will be visible when you will try to add a date in the input type.

Note − The input type date is not supported by Firefox and Internet Explorer. It works on Google Chrome.

How to use input type field with date field in HTML?

Example

You can try to run the following code to use input type field with date field in HTML. Here, we’re entering the date of birth.

<!DOCTYPE html>
<html>
   <head>
      <title>HTML input date</title>
   </head>

   <body>
      <form action = "" method = "get">
         Enter Registration Date:<br>
         <input type="date" name="birthday"><br>
         <input type="submit" value="Submit">
      </form>
   </body>
</html>