I am trying to parse some of the French dates in JAVA. Here are some samples.
- 25 septembre 2013 a 21h42 par -- Working
- 1er juillet 2013 a 19h26 par -- Not Working
Here is the code:
Date sampleDate = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRENCH)
.parse("25 septembre 2013 a 21h42 par");
System.out.println(sampleDate);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
System.out.println(simpleDateFormat.format(sampleDate));
I was able to parse successfully (the first date) but not able to parse the second date (1er juillet 2013 a 19h26 par). But If I remove "er" from the date its working. So how can solve this problem.?
Here is the error:
Exception in thread "main" java.text.ParseException: Unparseable date: "1er juillet 2013 a 19h26 par"
at java.text.DateFormat.parse(DateFormat.java:366)
at misc.DateSample.main(DateSample.java:27)
Can any one help me on this.?
Thanks & Regards, Amar.T