Calculating Age based DOB and Today's date
Currently, these are the fields I have.
DoB Field name: Date of Birth
Date Field name: Date of Today [Calculated using the following script] which is read-only so every time our front desk opens this document, the date is automatically filled.
var fld = this.getField("Date of Today"); fld.value = util.printd("mm/dd/yyyy",new Date());Age field name: Age

I am using Acrobat DC. I have my Age to "read-only" as well. Currently, I have this script running and nothing is populating on the Age fields.
event.value = "";
var dobValue = getField("Date of Birth").value;
if (dobValue!="") {
var dob = util.scand("mm/dd/yyyy", dobValue);
var today = new Date();
var age = today.getFullYear() - dob.getFullYear();
if (today.getMonth() < dob.getMonth()) age = age - 1;
if ((today.getMonth() == dob.getMonth()) && (today.getDate() < dob.getDate())) age -= 1;
event.value = age;
}Help me out on this? I have absolutely no knowledge of Java at all. I am just following instructions on the web.
