0
     String inputStr = "05/01/2012 10:51:47 AM PDT";
     String inputFmt = "MM/dd/yyyy hh:mm:ss a z";
     SimpleDateFormat dfLong = new SimpleDateFormat(inputFmt);;
     Date localModifiedDate = dfLong.parse(inputStr);
     System.out.println(localModifiedDate);

给了我无法解析的日期异常

4

1 回答 1

2

您的默认设置Locale可能无法解析AM/PM标记和/或时区。尝试ENGLISH Locale

SimpleDateFormat dfLong = new SimpleDateFormat(inputFmt, Locale.ENGLISH);
于 2013-05-08T18:55:47.643 回答