## Calculated age from a filled field

Apr 27, 2018

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 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.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

175

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

## Calculated age from a filled field

Apr 27, 2018

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 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.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

176

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Apr 27, 2018 0
Apr 27, 2018

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.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Apr 27, 2018 1