in Java, how to parse a date string that contains a letter that does not represent a pattern?
\"2007-11-02T14:46:03+01:00\"
String date =\"2007-11-0
If you don't care about the time zone, you can use this method.
public static Date convertToDate(String strDate) throws ParseException {
Date date = null;
if (strDate != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
date = sdf.parse(strDate);
}
return date;
}
I don't know if it's still useful for you, but I encounter with the same problem now, and after a little I come up with this.