Here you can find the source of currentYearMonth()
public static int currentYearMonth()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { private static final String YYYYMMINTFORMAT = "yyyyMM"; public static int currentYearMonth() { Calendar c = Calendar.getInstance(); return formatDateIntValue(c.getTime(), YYYYMMINTFORMAT); }/*ww w.ja v a 2 s .c o m*/ private static int formatDateIntValue(Date updateTime, String dateIntFormat) { return Integer.parseInt(formatStr(updateTime, dateIntFormat)); } public static String formatStr(Date date, String dateFormat) { return new SimpleDateFormat(dateFormat).format(date).toString(); } }