I'm trying to parse a date and convert to a Timestamp
.
On Android 6 it works, but on Android 7 it throws an exception. Can any tell me how to fix it?
private long getCorrectDate(String date) {
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss 'GMT'Z (z)");
Date parsedDate = null;
try {
Logger.e("PARSE DATE : "+date);
parsedDate = dateFormat.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
Timestamp timestamp = new java.sql.Timestamp(parsedDate.getTime());
Logger.e("" + date + " TO " + timestamp.getTime());
return timestamp.getTime();
}
java.text.ParseException: Unparseable date: "Thu Feb 15 2018 10:55:55 GMT+0000 (UTC)"