Here you can find the source of getCurMonthStr()
public static String getCurMonthStr()
//package com.java2s; import java.util.Calendar; public class Main { public static String getCurMonthStr() { Calendar cal = Calendar.getInstance(); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH) + 1; return getDate(year, month); }//from ww w .j av a2 s . co m public static String getDate(int year, int month) { String date = null; String a = String.valueOf(year); String b = String.valueOf(month); if (month > 9) { date = a + b; } else { date = a + "0" + b; } return date; } }