Calculated age from a filled field

New Here ,
Apr 27, 2018

Copy link to clipboard

Copied

How can i calculate age in a form based on the birth date that the user will input?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

197

Likes

Translate

Translate

Report

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

1 Correct Answer

Adobe Community Professional , Apr 27, 2018
gkaiseril Adobe Community Professional , Apr 27, 2018
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 ...

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Apr 27, 2018

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.

Likes

Translate

Translate

Report

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