The <input> tag with a type="datetime-local"
attribute creates an input field that accepts a date and time value which does not include the timezone (hence ‘local‘).
Clicking the calendar icon opens a datetime picker.
An <input> element of type datetime-local.
Clicking the calendar icon opens a datetime picker.
Alternatively, enter a datetime directly into the field.
<form action="/tutorial/action.html">
<fieldset>
<legend>Registration date</legend>
<input type="datetime-local" name="registrationdate"><br /><br />
<input type="submit" value="Submit">
</fieldset>
</form>
The <input type="datetime-local">
tag creates an input field for date and time.
The -local suffix does not mean the time is local to the user, instead it is a time without a timezone.
The UI of this control varies from browser to browser. Browser support is limited.
A similarly named <input type="datetime">
is obsolete.
<input type="datetime-local">
Here is when type="datetime-local"
support started for each browser:
Chrome
|
25.0 | Jan 2015 |
Firefox
|
Not Supported | |
IE/Edge
|
38.0 | Nov 2015 |
Opera
|
10.0 | Aug 2009 |
Safari
|
Partial Support |
Back to <input>