Here you can find the source of getYearMonthInt(Date date)
public static Integer getYearMonthInt(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static Integer getYearMonthInt(Date date) { Calendar cal = new GregorianCalendar(); cal.setTime(date);/* w ww.j a v a2s .c o m*/ return getYearMonthInt(String.valueOf(cal.get(Calendar.YEAR)), String.valueOf(cal.get(Calendar.MONTH) + 1)); } public static Integer getYearMonthInt(String year, String month) { int yearInt = Integer.parseInt(year); int monthInt = Integer.parseInt(month); return yearInt * 12 + (monthInt - 1); } }