HTML Date and Time Input Generator
WM-30Choose the input type, type a label and any limits, and copy a labelled input. Values and limits are checked against the format that type requires.
Runs in your browser. Nothing is uploaded.
Key: value lines (label: is required; also name:, value:, min:, max:, step:, required:, readonly:, disabled:)
HTML
How to use it
- Pick the input type: date, time, datetime-local, month or week.
- Type label: and optionally name:, value:, min:, max:, step: and required:.
- Write dates in the format that type uses, for example 2026-11-21 for date.
- Copy the label and input.
The value format is fixed
Browsers show a date in the user locale, but the value in the markup and in the submitted form is always the same machine format. A date is YYYY-MM-DD, a time is HH:MM with optional seconds, a month is YYYY-MM, a week is YYYY-Www such as 2026-W47, and datetime-local is the date, the letter T and the time. A value in another form is ignored by the browser and the field stays empty. This tool refuses a bad value and says which line and which type it did not fit.
min, max and step
min and max use the same format as value and set the earliest and latest choices; the browser marks values outside them as invalid. step is in the unit of the type: days for date, weeks for week, months for month and seconds for time and datetime-local. For time and datetime-local, the default step is 60 seconds, so a 30 second step is needed before seconds can be chosen. The tool checks that min is not after max but does not check how step lines up with them.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
"min:" is later than "max:". | The earliest allowed value comes after the latest. | Swap them or fix the dates. |
Add a "label:" line. An input needs a visible label so screen readers can name it. | The input needs a visible label and none was given. | Add a label: line. |
Questions people ask
How do I add a date picker in HTML?
Use an input of type date with a label. Browsers then show their own date picker. Give it a name so it is submitted, and use min and max to limit the dates that can be chosen.
What format does an HTML date input use?
The value is always YYYY-MM-DD, whatever date format the user sees. So 21 November 2026 is written 2026-11-21 in the value, min and max attributes.
What is the difference between date, datetime-local and time?
date holds a calendar date, time holds a time of day, and datetime-local holds both with no time zone. There is no input type that records a time zone, so store the zone separately if it matters.
How do I set a default value on a date input?
Add a value: line in the right format. For a week input that is 2026-W47, and for a month it is 2026-11. A value in the wrong format is not shown by the browser, so the tool rejects it.
Is there a way to limit a date input to the next 30 days?
Set min to today and max to the date 30 days away, both in YYYY-MM-DD. They must be written in the markup or set by script, because HTML has no built-in way to say relative to today.
About this tool
Writes a label and an input of the type you choose, linked by for and id. Output is a label plus the control, joined by the for and id attributes; the id comes from an id: line, else the name, else the label. The value:, min: and max: lines are checked against that type, so a date for the date type, 2026-W47 for week, 2026-11 for month, and a time for time; a bad value is refused instead of written. Add min: and max: lines in the same form, for example min: 2026-11-21 for the date type. Week 53 is accepted only in years that have one. The tool does not check that min is reachable from value, and it writes no script. Optional lines: id:, class:, title:, lang:, data-* and aria-*.