java - Error while parsing a time string -
this question has answer here:
i trying parse time strings this:
string time_string = "10:00 am"; simpledateformat format = new simpledateformat("hh:mm a"); date date = null; try {     date = format.parse(time_string);     // 'date' } catch (parseexception e) {     log.w("time", e.tostring()); }   but parser failing exception:
java.text.parseexception: unparseable date: "10:00 am"
what doing wrong?
the am/pm marker may not match of default locale try
simpledateformat format = new simpledateformat("hh:mm a", locale.english);      
Comments
Post a Comment