Hello i need to parse this string
Sun, 15 Aug 2010 3:50 PM CEST
I’m using SimpleDataFormat in this way
String date = "Sun, 15 Aug 2010 3:50 pm CEST";
DateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy h:mm a Z");
Date d = formatter.parse(date);
but it throws an exception.
Can you help me please?
Thanks
SimpleDateFormatis sensitive to theLocalethat is currently set. So it can be that there is a problem when trying to parse the format with your current one. With your constructor it usesLocale.getDefault()to determine the setting.You could try to create the
DateFormatexplicitly using theLocale.USvianew SimpleDateFormat(pattern, Locale.US)and verify if the problem also exists in that case.