Here you can find the source of getMonthStr(Calendar cal)
public static String getMonthStr(Calendar cal)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; public class Main { public static String getMonthStr(Calendar cal) { int month = cal.get(Calendar.MONTH) + 1; return month > 9 ? "" + month : "0" + month; }/*from w w w. j av a 2 s .co m*/ }