I'm attempting to parse a new Date object, but I keep hitting the following error.
W/System.err: java.text.ParseException: Unparseable date: "Thu May 16 09:28:39 GMT+01:00 2019"
I've attempted various different patterns for dateFormat, but nothing seems to work.
This is where the error is.
c.setTime(dateFormat.parse(oldDate));
Code
  public static String addDay(int numberOfDays) {
    String oldDate = String.valueOf(new Date());
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy'T'HH:mm:ss", Locale.ENGLISH);
    Calendar c = Calendar.getInstance();
    try {
     c.setTime(dateFormat.parse(oldDate));
    } catch (ParseException e) {
        e.printStackTrace();
    }
    c.add(Calendar.DAY_OF_YEAR,numberOfDays);
    dateFormat=new SimpleDateFormat("dd-MM-yyyy'T'HH:mm:ss",  Locale.ENGLISH);
    Date newDate=new Date(c.getTimeInMillis());
    String resultDate=dateFormat.format(newDate);
    return resultDate;
}
 
     
     
    