我没有找到如何将此字符串转换为正确的日期:
java.text.ParseException: Unparseable date: "Sat, 26 Mar 2016 09:46 PM CET" (at offset 0)
我尝试过很多东西:
SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm a z", Locale.ENGLISH);
有或没有简单的引用。
请问有人帮帮我吗?
目标是在设备上显示时使用用户区域设置进行翻译。
这是应用中的代码:
try {
SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm a z", Locale.ENGLISH);
Date testDate = null;
testDate = sdf.parse(loc_Value);
Tracer.e(mytag + "Date conversion", "Works");
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm");
String newFormat = formatter.format(testDate);
value.setText(newFormat);
} catch (Exception ex) {
ex.printStackTrace();
Tracer.e(mytag + "Date conversion", "Error: " + ex.toString());
value.setText(loc_Value);
}