我有來自以下形式輸入的日期:無法解析日期例外:格式輸入日期爲指定格式
無法解析日期:"Sun Jan 08 18:38:54 CST 2012"
我想使用的SimpleDateFormat
(formatter = new SimpleDateFormat("dd-MM-yy");) and chop off the time xx:xx:xx CST piece at the end. The date should be instead: 07-01-2012.
如何解析上述輸入日期到這個日期格式dd-MM-yy
編輯:
String str_date = (String)this.studentForm.getDateOfBirth().getValue().toString();
try {
date = (Date)formatter.parse(str_date); // exception
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
後你所得到的錯誤.. – 2012-01-06 01:23:14