HTML <input> Tag with 'type=date'

<form name="myForm" action="https://www.PuStudy.Com/html-solution/resources/html-forms-action.html">
	
<input type="date" name="myDateField">

<button>Submit</button>
</form>

The above example demonstrates usage of the <input> element with the type attribute set to date (i.e. type="date").

The date value represents a control for setting the element's value to a string representing a specific date. This is a date (year, month, day) with no time zone.

Specifying a min and/or max Date

The min and max attributes can be used with dates to specify a minimum and maximum date. If specified, they must have a value that is a valid date string.

The following example specifies a min date of 3 days ago and a max date of 3 days time. Therefore the user can only select dates that fall within that range.

<form name="myForm2" action="https://www.PuStudy.Com/html-solution/resources/html-forms-action.html">
	
<input type="date" min="2017-10-16" max="2017-10-22" name="myDateField2">

<button>Submit</button>
</form>

Specifying a step

You can also use the step attribute to limit the number of days the user can choose from.

The following example uses a step value of 3 days, meaning the user can only select one date in every three days.

<form name="myForm3" action="https://www.PuStudy.Com/resources/html-forms-action.html">
	
<input type="date" step="3" name="myDateField3">

<button>Submit</button>
</form>

You can also use the datetime, time, week, and month values when working with dates and times.