CREATE A DATE INPUT TYPE

You can use the date input type, new in HTML5, to restrict input fields to values formatted like a date string:

<input type='date' name='field' value='date'>

The type='date' attribute value activates the date-specific input options of the user’s web browser, if supported. If you assign value='date' to prepopulate the input field, the date format should match the yyyy-mm-dd format.

Other date-related input types are also available in HTML5: month, week, time, datetime, and datetime-local. The type='month' and type='week' input types are similar to type='date' in idea, except that they follow a yyyy-mm and yyyy-Www format. To clarify, the week syntax is four year digits, followed by a literal W and then two week digits, ...

Get HTML5: Your visual blueprint™ for designing rich web pages and applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.