Which input type is used to choose the date in HTML ?
Last Updated :
30 Jan, 2022
In this article, we will learn how to choose the date from the calendar on the webpage. As we know that HTML 5 introduced many inputs types for the better functionality of the form.
The <input type=”date”> input type is used to choose the date in HTML. It is used to develop input fields that tend the user enters a date, or use a textbox that validates the input or you can also choose a date from a special date picker interface.
Syntax
<input type = "date">
Example: Below HTML Code illustrates how to choose a date in HTML Form.
HTML
<!DOCTYPE html>
< html >
< head >
< title >
Which input type is used to
choose the date in HTML?
</ title >
< style >
h1,
h2 {
color: green;
}
h2 {
font-family: serif;
}
body {
text-align: center;
}
</ style >
</ head >
< body >
< h1 >GeeksforGeeks</ h1 >
< h2 >Enter the Date</ h2 >
< h4 >Enter Date of Birth:
< input type = "date" id = "test"
value = "2019-07-02T25:32Z" >
</ h4 >
</ body >
</ html >
|
Output:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...