The datetime-local type is used to specify the both date and time. It displays the complete particular date (year, month and date) and time(hour and minute). It is in 12 hour format, so the user also have to set AM or PM while setting the time. The datetime-local type is used in <input> tag.
Syntax of Datetime-local Input Type
<input type= "datetime-local">
The datetime-local input type is supported by Google Chrome, Safari and Opera.
HTML5 datetime-local Input Type Example
Appointment to the Doctor :<input type="datetime-local" >
- Here in this program we have to set both date and time with AM & PM by using datetime-local type in input tag.
- <input type=”datetime-local” > is used for datetime-local type.
HTML5 Datetime-local Demo
- Save the file as datetime-local_example.html in your system.
- Just open the file in the browser, you will see the below picture in the browser.
Note that the browser must support HTML5 specification.
When the execution process is completed successfully we will get the following output:
Here we can set the complete date and time of 12 hour format.