Test it Now
Output
Age of the date entered: 12 years
Example 2: dynamic date input
In this example, we will create an HTML form to take the date input from the user and then calculate the age using JavaScript. It will take dynamic input from the user. This HTML form will use the calendar to choose date input.
Copy Code