Javascript Date calculateMonths(fromDate, toDate)
function calculateMonths(fromDate, toDate) { var fromDateObject = new Date(fromDate), toDateObject = new Date(toDate), timeDifference = toDateObject.getTime() - fromDateObject.getTime(), millisecondsPerMonth = 1000*60*60*24*30; return Math.round(timeDifference/millisecondsPerMonth); }