I'm using this code to parse a Date, but in this case my date String is as follows:
Fri, 14 Oct 2016 13:56:15 +0200
(spanish Spain)
Don't know offset 8 and, or how to fix that parse error.
PD: I've tried too this solution with no success.
My code....
public String convertDate(String d) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MM-yyyy hh:mm", new Locale("es"));
try
{
Date date = simpleDateFormat.parse(d);
return simpleDateFormat.format(date);
//System.out.println("date : "+simpleDateFormat.format(date));
}
catch (ParseException ex)
{
System.out.println("Exception "+ex);
}
return "Error en la fecha";
}
Logat
I/System.out: Exception java.text.ParseException: Unparseable date: "Fri, 14 Oct 2016 13:56:15 +0200" (at offset 0)
I/System.out: Exception java.text.ParseException: Unparseable date: "Thu, 13 Oct 2016 11:48:48 +0200" (at offset 0)
I/System.out: Exception java.text.ParseException: Unparseable date: "Wed, 12 Oct 2016 13:57:02 +0200" (at offset 0)
I/System.out: Exception java.text.ParseException: Unparseable date: "Thu, 13 Oct 2016 21:06:31 +0200" (at offset 0)
PD2: Using Android Studio