java - Convert String to Date error -
this question has answer here:
- java - unparseable date 2 answers
i try convert string date format, following does't work.
string stringdate = "fri mar 27 17:14:27 eet 2015"; dateformat format = new simpledateformat("eee mmm dd hh:mm:ss zzz yyyy"); try { date newdate = format.parse(stringdate); } catch (parseexception e) { e.printstacktrace(); }
the output
java.text.parseexception: unparseable date: "fri mar 27 17:14:27 eet 2015"
simpledateformat
locale-sensitive, default locale may reason why exception thrown. try setting locale us.
dateformat format = new simpledateformat("eee mmm dd hh:mm:ss zzz yyyy", locale.us);
Comments
Post a Comment