I am parsing the date string but getting the parse exception in Arabic
mode but works fine when the language in the app is set to English
.
ParseException
06-15 19:16:07.607: W/System.err(27340): java.text.ParseException: Unparseable date: "6-15-2014" (at offset 2)
06-15 19:16:07.617: W/System.err(27340): at java.text.DateFormat.parse(DateFormat.java:626)
But this is parsing fine in English.
Code
SimpleDateFormat format = new SimpleDateFormat(formatString);
Date date = null;
try {
date = new SimpleDateFormat("MM-dd-yyyy").parse(detail.getContactBDate());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Can anyone please point out that what is missing? or in other languages what I can do to prevent these types of strings?
Thanks in advance