How to get the Android date format "7/25/2021" to July/25/2021
Here is the portion of the code
mDisplayDate is the Textview
mDisplayDate.setOnClickListener(view -> { Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
int day = cal.get(Calendar.DAY_OF_MONTH);
String dateLong = month + "/" + day+ "/" + year;
mDisplayDate.setText(dateLong);
The easiest way to do this is to use a switch case
String monthStr = "";
switch(month) {
case 1:
monthStr = "January";
break;
case 2:
monthStr = "February";
break;
// and else
}
String dateLong = monthStr + "/" + day+ "/" + year;