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

Popular posts from this blog

rest - Spring boot: Request method 'PUT' not supported -

php - Magento - Deleted Base url key -

symfony - imagine_filter() not generating the correct url in LiipImagineBundle -