Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static int getCurrentMouth() { Calendar cal = Calendar.getInstance(); int year = cal.get(Calendar.YEAR); int mouth = cal.get(Calendar.MONTH); int day = cal.get(Calendar.DATE); int currentIndex = (year - 1970) * 12 + mouth; return currentIndex; } }