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!
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!!!
@+
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.
@+
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.
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:
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?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
@bebarth it worked! I fixed date fromating issue that was preventing the calculation to work on the DOI and Sx dates. Thank you much!
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.