i have date coming from server & is in the format = "2013-01-20T16:48:43" my application support Both Arabic & English Locale. But when i change the locale to Arabic the date is not parsing its giving me parse exception. till now what i have written is
private static Date parseJsonDate(final String string) throws Exception
{
final String change_Locale = Locale.getDefault().getISO3Language();
if (change_Locale.equalsIgnoreCase("ara"))
{
System.out.println(":: Date :::" + string);
final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", new Locale("ar"));
System.out.println("new date " + format.parse(string));
return format.parse(string);
Do not parse your date into the Arabic it will give you error alwayz besides try as below by setting the Locale ENGLISH only.
final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With