Dates and times in HTML
Five input types the browser already knows how to render a picker for.
<label for="day">Date</label>
<input type="date" id="day" name="day" min="2026-01-01"
max="2026-12-31">
<label for="slot">Time</label>
<input type="time" id="slot" name="slot" step="900">
<label for="when">Date and time</label>
<input type="datetime-local" id="when" name="when">
<label for="cycle">Month</label>
<input type="month" id="cycle" name="cycle">
How it works
- Each type has its own value format;
dateis alwaysYYYY-MM-DD. minandmaxtake a value in that same format.weekandmonthexist too, and are the least widely supported.
The run, in numbers
- Lines
- 12
- Characters to type
- 360
- Tokens
- 101
- Three-star pace
- 70 tpm
At the three-star pace of 70 tokens a minute, this run takes about 87 seconds.
Step 2 of 4 in Numbers, dates & files, step 16 of 25 in Forms & inputs.