HTML: input type="datetime-local"
The local date-time input collects a date and time without including a time-zone offset.
What you will learn
- How to label a local date-time field
- How the submitted value is represented
- Why an application must define the relevant time zone
Minimal example
<label for="meeting">Meeting time</label>
<input id="meeting" name="meeting" type="datetime-local"
step="900" required>The submitted value contains a local date and time, but no offset. A browser cannot tell whether the time is in Tokyo, London, or another zone.
Common mistakes
- Do not use this type alone for an event that crosses time zones; collect or infer the zone explicitly.
- Explain the displayed zone to users and convert consistently when storing or sending the value.
- Validate business hours and allowed dates on the server.