I have created this funtion to parse date but this gives exception : Unparseable date: "Fri Oct 10 23:11:07 IST 2014" (at offset 20) . Please help as I am not able to figure out whats wrong with this code.
public Date parseDate() {
String strDate ="Fri Oct 10 23:11:29 IST 2014";
String newPattern = "EEE MMM dd HH:mm:ss Z yyyy";
SimpleDateFormat formatter = new SimpleDateFormat(newPattern);
try {
Date date = formatter.parse(strDate);
return date;
} catch (java.text.ParseException e) {
e.printStackTrace();
}
return null;
}
//setting the formatter to be lenient solves the problem
Thanks folks for helping....