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;
}

Popularity: 25% [?]

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
You can leave a response, or trackback from your own site.

Leave a Reply