Copy link to clipboard
Copied
How can i calculate age in a form based on the birth date that the user will input?
You will need to use JavaScript for the calculation.
The process is to convert the date string to a JavaScript date object using the util.scand method. You will also need to get the system date into a JavaScript date object. From the 2 date objects you can either get the number of milliseconds form the Epoch date for JavaScript, compute the difference, and then convert to the number of years. Or you can use the date object's methods to get the full year, month, and dates from the 2 date objects
...Copy link to clipboard
Copied
You will need to use JavaScript for the calculation.
The process is to convert the date string to a JavaScript date object using the util.scand method. You will also need to get the system date into a JavaScript date object. From the 2 date objects you can either get the number of milliseconds form the Epoch date for JavaScript, compute the difference, and then convert to the number of years. Or you can use the date object's methods to get the full year, month, and dates from the 2 date objects and then do the needed math to compute the number of years, months and days as needed.
This question has been asked many times and many solutions have been posted. Please use the search tool for this form to locate them.