Here you can find the source of getCurrentYearMonth()
public static String getCurrentYearMonth()
//package com.java2s; //License from project: Apache License import java.util.Calendar; public class Main { public static String getCurrentYearMonth() { int year = getCurrentYear(); int month = getCurrentMonth(); String yearMonth = ""; if (month >= 10) { yearMonth = String.valueOf(year) + String.valueOf(month); } else {/*from w w w . j a v a 2 s . c o m*/ yearMonth = String.valueOf(year) + "0" + String.valueOf(month); } return yearMonth; } public static int getCurrentYear() { Calendar cal = Calendar.getInstance(); // return cal.getTime().getYear()+1900; return cal.get(Calendar.YEAR); } public static int getCurrentMonth() { Calendar cal = Calendar.getInstance(); return cal.get(Calendar.MONTH) + 1; } }