Using the INPUT Date Tag in HTML 5

HTML letters on keyboard
 Max Pixel

The date INPUT tag gives you a way to request dates in your web form in HTML 5. The date is collected with the year, month, and day, but without a time zone. The browser should display a calendar or other date control input device to allow users to submit dates.

INPUT Date Web Browser Support

As of 2018, only Opera 9+ supports the INPUT date type with a calendar. All other browsers display a text box.

You can still use this input type, you just have to validate that the contents are a date with a script or CGI.

INPUT Date Attributes

Global attributes, event attributes, and the input tag attributes. Plus:

  • Autocomplete
  • List
  • Max
  • Min
  • Readonly
  • Required
  • Step
  • ValueAsNumber
  • SelectedOption
  • StepDown()
  • StepUp()

INPUT Date Usage

Standard date input tag:

​<input type="date" value="2010-12-16;">

INPUT Date Special Notes

The input date tag is only supported in Opera 9+ if you want a calendar displayed, but you can still use this input type and validate that the submitted data is a date. That way, when other browsers start supporting it, your forms won't have to be modified.

Was this page helpful?