public static int getMonthSpan(Date begin, Date end) {
        Calendar beginCal = new GregorianCalendar();
        beginCal.setTime(begin);
        Calendar endCal = new GregorianCalendar();
        endCal.setTime(end);
        int m = (endCal.get(Calendar.MONTH)) - (beginCal.get(Calendar.MONTH));
        int y = (endCal.get(Calendar.YEAR)) - (beginCal.get(Calendar.YEAR));
        return y * 12 + m;
    }
public static int getMonthSpan ( Date begin , Date end ) { Calendar beginCal = new GregorianCalendar ( ) ; beginCal . setTime ( begin ) ; Calendar endCal = new GregorianCalendar ( ) ; endCal . setTime ( end ) ; int m = ( endCal . get ( Calendar . MONTH ) ) - ( beginCal . get ( Calendar . MONTH ) ) ; int y = ( endCal . get ( Calendar . YEAR ) ) - ( beginCal . get ( Calendar . YEAR ) ) ; return y * 12 + m ; }
#func 获取月份差<br>

@author dongguoshuang