Android 4.3 Jelly Bean Temporary format issue

My date format is "yyyy-MM-dd", and when I get the month using this function, it returns me the wrong month format. For example, instead of "July", he returns me only "J"

here is the function:

public static String getMonthName(String date) { Date mDate = Utils.parseDate(date); SimpleDateFormat sdf = new SimpleDateFormat("MMMMM"); String time = sdf.format(mDate); return time; } 

and the idea of ​​what to do?

Edit: and here is my parseDate(String date) function

 public static Date parseDate(String date) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); try { return formatter.parse(date); } catch (ParseException e) { e.printStackTrace(); return new Date(); } } 
+6
source share
1 answer

I think you have one M much

M: 1 MM: 01 MMM: Jan MMMM: January MMMMM: J

+5
source

Source: https://habr.com/ru/post/950696/


All Articles