My date format is this "yyyy-MM-dd" and when i get month using this function it return me wrong format of month. For example instead of "July" it return 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;
}
andy idea 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();
}
}
I think you have one M to much
M:1 MM:01 MMM:Jan MMMM:January MMMMM:J
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With