Reputation:
I'm trying to parse a String describing a date (in french) :
String dateAParser="dim 6 janv 2013 07:40:00";
SimpleDateFormat parseur = new SimpleDateFormat("EEE dd MMMM yyyy HH:mm:ss", Locale.FRENCH);
try{
Date dateAllerDepart= new Date();
dateAllerDepart=parseur.parse(dateAParser);
System.out.println(dateAllerDepart);
}catch(Exception e){e.printStackTrace();}
It gives me these errors :
java.text.ParseException: Unparseable date: "dim 6 janv 2013 07:40:00"
at java.text.DateFormat.parse(DateFormat.java:357)
at TestAvecJsoup.main(TestAvecJsoup.java:109)
I think my SimpleDateFormat object is ok, and I searched and tried a lot of things to solve this problem, so I hope you will give some clues on how to solve it.Thank you in advance.
Upvotes: 4
Views: 5011
Reputation: 7349
Two minor changes, adding periods after the abbreviations, and using 3 Ms instead of 4:
final String dateAParser = "dim. 6 janv. 2013 07:40:00";
final SimpleDateFormat parseur = new SimpleDateFormat("EEE dd MMM yyyy HH:mm:ss", Locale.FRENCH);
Upvotes: 5
Reputation: 5250
The first part of date String "dim" and month seems to be the issue here, are you sure it's correct value?
This works fine.
String dateAParser="06 2013 07:40:00 AM";
SimpleDateFormat parseur = new SimpleDateFormat("dd yyyy hh:mm:ss a", Locale.FRENCH);
Upvotes: 0