Reputation: 378
In my app I am using calendar view of DatePicker, but it doesn't display name of current month. I think it is not very convenient for user. Is there a way to display month name?
Upvotes: 1
Views: 3182
Reputation: 3912
You can do something like this:
DatePicker datepicker=new DatePicker();
int month=date.getMonth();
public static final String[] MONTHS = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
String mon=MONTHS[month];
Hope this helps!
Upvotes: 2
Reputation: 10553
Try something like this
public static final String[] MONTHS = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
String mon=MONTHS[monthNumber];
and use the mon
Upvotes: 2