-1

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
  • 163
  • 1
  • 2
  • 12

2 Answers2

9

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

Hasanaga
  • 1,059
  • 1
  • 8
  • 18
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
  • 723
  • 2
  • 5
  • 22