• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Calculated age from a filled field

New Here ,
Apr 27, 2018 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

492

Translate

Translate

Report

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

correct answers 1 Correct answer

LEGEND , Apr 27, 2018 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

...

Votes

Translate

Translate
LEGEND ,
Apr 27, 2018 Apr 27, 2018

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

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