Posts Tagged ‘month’

Get month name from Calendar.MONTH field

Here’s a method to get the month name from the Calendar.MONTH field:

public String getMonthFromInt(int iMonth) {
String month = "invalid";
DateFormatSymbols dfs = new DateFormatSymbols();
String[] months = dfs.getMonths();
if (iMonth >= 0 && iMonth <= 11)
month = months[iMonth];
return month;
}