HTML: input type="time"
The time input collects a time of day, such as an appointment start time, without a date or time-zone offset.
What you will learn
- How to label a time field
- How to constrain valid times with min, max, and step
- When to use a date-time input instead
Minimal example
<label for="opening">Opening time</label>
<input id="opening" name="opening" type="time"
min="09:00" max="18:00" step="900" required>The submitted value represents a time such as 09:00. The picker style and whether seconds are shown can vary by browser; use step when a particular precision matters.
Common mistakes
- A time alone has no date or time zone. Use a date-time design when those are important.
- Explain the relevant time zone when users may be in different regions.
- Validate business hours and other rules on the server as well as in the browser.