等如上错误里面改成你传过来的string字符串的格式
DateFormat fmt =new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
public static Date toDate(String szBeginTime) throws ParseException { DateFormat fmt =new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); Date date = fmt.parse(szBeginTime); return date; }