My date string is "Oct 17 2016 12:17PM" and My date parsing method is:
public static String formatDate(String dateString) {
String stringDate = "";
try {
//Mar 11 2016 2:21PM
if (dateString != null) {
SimpleDateFormat dt = new SimpleDateFormat("MMM dd yyyy hh:mma");
Date date = dt.parse(dateString);
// *** same for the format String below
SimpleDateFormat dt1 = new SimpleDateFormat("EEE , hh:mm a");
stringDate = dt1.format(date);
}
return stringDate;
} catch (ParseException parseException) {
Log.e("date format", "" + parseException.getMessage());
}
return stringDate;
}
It is working fine with english language but when i change my app language to hindi or any other i am getting an exception.
java.text.ParseException: Unparseable date: "Oct 17 2016 12:17PM" (at offset 0)
What i do?