Here you can find the source of getIntMonthShift(Date Shift)
public static int getIntMonthShift(Date Shift)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static Date gamedate = new Date(); public static int getIntMonthShift(Date Shift) { Calendar tempcalendar1 = GregorianCalendar.getInstance(); Calendar tempcalendar2 = GregorianCalendar.getInstance(); tempcalendar1.setTime(Shift);/*from w w w .ja va 2 s.co m*/ tempcalendar2.setTime(gamedate); int month1 = tempcalendar1.get(Calendar.MONTH); int month2 = tempcalendar2.get(Calendar.MONTH); month1 = month1 + 12 * (tempcalendar1.get(Calendar.YEAR) - tempcalendar2.get(Calendar.YEAR)); return month1 - month2; } }