EXACT Difference between two dates in months
HI! I have a formula that is calculating the difference between two dates and converting it into a decimal, however it is calculating off a 30 day month and I want it to be exact. For example DOB-06/02/17, Date6 is 7/29/19, the calculation I am getting is 26,23, when it should be 25.94. There are 788 days between the two dates, but I need to know the difference in months. Below is my calculation-can anyone help? If I can't make this happen, can I override the calculation and manually enter the correct info? Thank you!!!
(function () {
var sStart = getField("DOB").valueAsString;
var sEnd = getField("Date6").valueAsString;
var dStart, dEnd, diff;
if(sStart && sEnd) {
dStart = util.scand("mm/dd/yyyy", sStart);
dEnd = util.scand("mm/dd/yyyy", sEnd);
diff = dEnd.getTime() - dStart.getTime();
event.value = Math.floor(diff / 864e5)/30;
} else {
event.value = "";
}
})();
