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);
给我Unparsable日期例外
答案 0 :(得分:1)
您的默认Locale
可能无法解析AM/PM
标记和/或时区。试试ENGLISH
Locale
:
SimpleDateFormat dfLong = new SimpleDateFormat(inputFmt, Locale.ENGLISH);