To provide option to user to select time, we can use type
attribute to time. Similarly, to provide option to select date and time both, we can use type attribute to datetime-local.
Despite the fact that datetime is also a valid type
value, it doesn't work in most of the browser.
Select Time:
<input type="time" name="myDateTime" id="myDateTime" />
<br />
Select Datetime Local:
<input type="datetime-local" name="myDateTimeLocal" id="myDateTimeLocal" />
<br />
Output
There is slight difference between datetime and datetime-local type attribute value.