java - Convert String to Date error -


this question has answer here:

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

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -