i use simple-xml in Android, and I get a date in the follow format "2013-05-13+02:00"
, I try to get the date in String format, after that i can't parse this date in this format!
private Date modifyDateLayout(String inputDate){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
Date date = format.parse(inputDate);
Log.i("date: ", date.toString());
return date;
} catch (ParseException e) {
Log.i("error ParseException : ", e.toString());
return null;
}
}
i get this error :
java.text.ParseException: Unparseable date: "2013-05-13+02:00"
Try doing this:
private Date modifyDateLayout(String inputDate){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd+HH:mm");
try {
Date date = format.parse(inputDate);
Log.i("date: ", date.toString());
return date;
} catch (ParseException e) {
Log.i("error ParseException : ", e.toString());
return null;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.