Here you can find the source of formatMonth(int timeInfo, String yearInfo)
private static String formatMonth(int timeInfo, String yearInfo)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { private static String formatMonth(int timeInfo, String yearInfo) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.set(Calendar.MONTH, timeInfo - 1); cal.set(Calendar.YEAR, Integer.parseInt(yearInfo)); SimpleDateFormat formatter = new SimpleDateFormat("MMM-yyyy"); return formatter.format(cal.getTime()); }/*from ww w . ja va 2 s . com*/ }