Harsha M V Harsha M V - 3 months ago 18x
Android Question

Android DatePicker display Month name

I am trying use Date Picker and on Select i want to display the date in the following format

[Month name] [date], [year]

final Calendar c = Calendar.getInstance();
mYear = c.get(Calendar.YEAR)-13;
mMonth = c.get(Calendar.MONTH);
mDay = c.get(Calendar.DAY_OF_MONTH);

that gives Month as a number. How to get the name of the month instead of number.

public static final String[] MONTHS = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

use an array and get the String by MONTHS[monthNumber].