HTML <input> Tag with 'type=datetime'
<form name="myForm" action="/resources/html-forms-action.cfm">
<input type="datetime" name="myDateTimeField">
<button>Submit</button>
</form>
The above example demonstrates usage of the <input>
element with the type
attribute set to datetime
(i.e. type="datetime"
).
The datetime
value represents a control for setting the element's value to a string representing a specific global date and time. This is a date and time (year, month, day, hour, minute, second, fraction of a second) with the time zone set to UTC.
Note: At the time of writing, the datetime
value had limited browser support.
The datetime
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-local
, date
, time
, week
, and month
values when working with dates and times.