Answered
I need the number of days between two dates in PDF form
Have attempted to generate the number of days between two dates using a custom calculation in a text field form and no matter what formula I use the field blank.
Can anyone help?
Have attempted to generate the number of days between two dates using a custom calculation in a text field form and no matter what formula I use the field blank.
Can anyone help?
Here you go:
var date1 = this.getField("Date1").valueAsString;
var date2 = this.getField("Date2").valueAsString;
if (date1 && date2) {
var d1 = new Date(date1);
var d2 = new Date(date2);
var year1 = d1.getFullYear();
var year2 = d2.getFullYear();
var month1 = d1.getMonth();
var month2 = d2.getMonth();
var diffInMonths = (year2 - year1) * 12 + (month2 - month1);
event.value = diffInMonths;}
else {
event.value = "";}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.