How to parse date using SimpleDateFormat? [duplicate]

  android, java, parsing

I am trying to parse dates with this format "Sun, 21 Feb 2021 22:13:42" and i am getting a runtime error saying "Unparseable date". Does anyone know why? Here is my parse method.

public Date parseDate(String date) {

       SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
        try {
            return simpleDateFormat.parse(date);
        }
        catch (Exception e) {
            e.printStackTrace();
            return new Date();
        }
    }
}

Source: Android Questions

LEAVE A COMMENT