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

Age calculation based upon date of birth and date of death in years, months and days.

New Here ,
Jun 05, 2021 Jun 05, 2021

Copy link to clipboard

Copied

I'm so sorry if I am asking for the 100th time, but i've searched so many posts and not seeing exactly what I need.  I work for a funeral home and we are now typing our arrangement information instead of hand writing them.  For our obituaries we always have to calculate the final age in years, months and days.  I thought if I could do a script to calculate it for me, it would save some time!  But, I know nothing about scripts in adobe.  Can somebody help me with the code?  My document will have the date of birth field and the date of death field, now I just need to have it calculate in years, months, and days in my age field.  PLEASE HELP!

TOPICS
JavaScript

Views

7.4K

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

Community Expert , Jun 08, 2021 Jun 08, 2021

You have to change:
...
if (util.scand("mm/dd/yyyy",this.getField("Deathday").valueAsString)>=util.scand("mm/dd/yyyy",this.getField("Birthday").valueAsString)) {
...
var DoB=parseInt(birthday[1]);
var MoB=parseInt(birthday[0]);
...
var DoD=parseInt(deathday[1]);
var MoD=parseInt(deathday[0]);
...
That's all for the script.
You also have to change the format of both date fields. Remove the script before changing them, else you will have the alert message!!!
@+

Votes

Translate

Translate
Community Expert ,
Apr 08, 2024 Apr 08, 2024

Copy link to clipboard

Copied

Sorry, I can't help you right now because I don't have my computer.... only my phone!

 I will have a look on your file tomorrow.

@+

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
Community Expert ,
Apr 08, 2024 Apr 08, 2024

Copy link to clipboard

Copied

You need to copy the full code, not just part of it. You should only adjust the field names used in it, nothing else.

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
New Here ,
Apr 08, 2024 Apr 08, 2024

Copy link to clipboard

Copied

excuse my ignorance on the subject:

I opened my file under the "Premare a form" fuction and made note of the pertnant field names (ApptDate, LVDate, LVnbYears, LVnbMonths, LVnbDays). When I look at the properties for ApptDate and LVDate I see info in the actons tab like this: 

Jackeline3654077073ud_0-1712610391052.png

In the value fields there are no setting for actions or calculations.

 

Is the scrip placed somewhere else? and I am looking int he wrong place?

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
Community Expert ,
Apr 09, 2024 Apr 09, 2024

Copy link to clipboard

Copied

Hi,

Attached is your file which should work correctly! Let me know...

@+

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
New Here ,
Apr 10, 2024 Apr 10, 2024

Copy link to clipboard

Copied

LATEST

@bebarth it worked! I fixed date fromating issue that was preventing the calculation to work on the DOI and Sx dates. Thank you much!

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
Community Expert ,
Jun 07, 2021 Jun 07, 2021

Copy link to clipboard

Copied

Also explore this discussion for additional insights:

 

 

In particular, see the contribution provided by NesaNurani about leap year and roll over dates.

 

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