How to convert month name to month number in java / android

 * @param monthNumber Month Number starts with 0. For <b>January</b> it is <b>0</b> and for <b>December</b> it is <b>11</b>.
 * @return
 private String getMonthFullName(int monthNumber)
 String monthName="";

 if(monthNumber>=0 && monthNumber<12)
 Calendar calendar = Calendar.getInstance();
 calendar.set(Calendar.MONTH, monthNumber);

 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMMM");
 monthName = simpleDateFormat.format(calendar.getTime());
 } catch (Exception e)

 return monthName;

Tags: , , , , , , , ,

About krishjlk

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: