input type="datetime"
The old <input type="datetime"> type was intended to collect a date and time in UTC. It is obsolete and should not be chosen for new forms.
What you will learn
- What the former UTC date-time input type was intended to represent
- Why current forms should consider
datetime-localor another type - How to think about values, time zones, and labels when collecting dates
Historical syntax
<!-- Do not use this obsolete type for a new form. -->
<input type="datetime" name="meeting">
Support for this type was removed or never implemented consistently across browsers. A browser may treat it as a plain text input, so the expected UTC picker and value format cannot be relied on.
What to use instead
datetime-localfor a local date and time chosen by the user.datewhen a time is not needed.timewhen only a time is needed.
If an application needs a moment in time, document the time zone clearly and normalize the submitted value on the server. Always provide a visible label and validate the received value.