Number of Months between DATES : AX Dynamics X++ code date month year diffrence.
private
void calcMonths(FromDate fromDate, ToDate toDate)
{
Month = intvNo(ToDate,FromDate,IntvScale::YearMonth);
}