I have the next problem with this date:
java.text.ParseException: Unparseable date: "Wed Jan 11 00:00:00 CET 2012"
I have this:
DateFormat formatter ;
Date dateIn=null;
formatter = new SimpleDateFormat( "EEE MMM dd HH:mm:ss yyyy" );
try {
dateIn = (Date)formatter.parse(dateI);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
What I'm doing bad?. Thanks
Use timezone and also a locale
SimpleDateFormat( "EEE MMM dd HH:mm:ss z yyyy", Locale.US);
to reflect English language in the input string (days and month names).
You need to add z
in your format string for including timezone. Try this:
SimpleDateFormat( "EEE MMM dd HH:mm:ss z yyyy" );
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.