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(); } }
source share