0

In date Picker I tried to get month in letter others are in integer It's returning full name of the month. But i want first threes letters of the month.

i tried:

SimpleDateFormat sdf = new SimpleDateFormat("yyyy,MMMM, dd ");
System.out.println(sdf.format(new SimpleDateFormat(new Date()).toString()));

output: 2013-October-18

I want output as : 2013-Oct-18

Sureshkumar S
  • 193
  • 1
  • 2
  • 13

2 Answers2

10

Use MMM, like this SimpleDateFormat("yyyy-MMM-dd ")

Hasanaga
  • 1,099
  • 1
  • 9
  • 19
1

Try the following code.Hopefully this will work...

Calendar cal=Calendar.getInstance();
SimpleDateFormat month_date = new SimpleDateFormat("MMM");
String month_name = month_date.format(cal.getTime());
Naveen
  • 814
  • 2
  • 9
  • 22