0

I'm unable to correctly parse a date.....

Here is the code :

String UpdateDateFormat = "Fri Mar 06 00:00:00 CET 2015";

SimpleDateFormat sdf2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy");

try{
     Date UpdateDateFormated = sdf2.parse(UpdateDateFormat);
}
catch(ParseException ex){
     System.out.println(ex.getMessage());
}

I get an exception, "Unparseable date..."

I saw this post : How to convert "Mon Jun 18 00:00:00 IST 2012" to 18/06/2012? but it's not working for me.

Any idea ?

Thanks for your help

Community
  • 1
  • 1
Vincent Caggiari
  • 307
  • 2
  • 10

1 Answers1

1
SimpleDateFormat sdf2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.US);

Just needed to add the Locale.US.

candied_orange
  • 7,036
  • 2
  • 28
  • 62
Vincent Caggiari
  • 307
  • 2
  • 10