HTML <input> Tag with 'type=datetime-local'
<form name="myForm" action="/resources/html-forms-action.cfm">
<input type="datetime-local" name="myField">
<button>Submit</button>
</form>
The above example demonstrates usage of the <input>
element with the type
attribute set to datetime-local
(i.e. type="datetime-local"
).
The datetime-local
value represents a control for setting the element's value to a string representing a local date and time, with no time-zone offset information. This is a date and time (year, month, day, hour, minute, second, fraction of a second) with no time zone.
The datetime-local
value was not introduced in HTML5, but at the time of writing, it has been introduced in the HTML 5.1 draft, as well as the WHATWG HTML Living Standard.
You can also use the datetime
, date
, time
, week
, and month
values when working with dates and times.