Here is my date String "Thu Feb 25 12:58:28 MST 2016" and I parse using this formate "E MMM dd HH:mm:ss Z yyyy".
But I am getting date parsing error.
What should I do?
I am parsing date string using following function
public static String getDate(String targrtDate) {
String dateStr = targrtDate;
DateFormat formatter = new SimpleDateFormat("E MMM dd HH:mm:ss Z yyyy");
Date date = null;
try {
date = (Date) formatter.parse(dateStr);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(date);
if (date == null) {
return "";
}
Calendar cal = Calendar.getInstance();
cal.setTime(date);
String formatedDate = cal.get(Calendar.DATE) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.YEAR);
String formatedTime = cal.get(Calendar.HOUR) + "/" + cal.get(Calendar.MINUTE);
Log.i("formatedDate", "" + formatedDate + " " + formatedTime);
return formatedDate;
}