Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android 4.3 jelly Bean Time format issue

Tags:

java

android

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();
        }
    }
like image 781
Ali Imran Avatar asked Jul 31 '13 08:07

Ali Imran


1 Answers

I think you have one M to much

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

like image 151
Flaxie Avatar answered Oct 21 '22 05:10

Flaxie