該代碼在幾臺設備中崩潰。java.text.ParseException:無法解析的日期:
SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy hh:mm a", Locale.ENGLISH);
format.setTimeZone(TimeZone.getTimeZone("GMT"));
Date date = null;
try {
date = format.parse(dtStart);
System.out.println("Date ->" + date);
} catch (Exception e) {
e.printStackTrace();
}
long ere = date.getTime()/1000;
錯誤:
System.err: java.text.ParseException: Unparseable date: "15-02-2016 08:56 p.m." (at offset 17)
System.err: at java.text.DateFormat.parse(DateFormat.java:579)