/** * 字符串转日期格式 * */ public static Date date(String date_str) { try { Calendar zcal = Calendar.getInstance(); Timestamp timestampnow = new Timestamp(zcal.getTimeInMillis()); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); ParsePosition pos = new ParsePosition(0); java.util.Date current = formatter.parse(date_str, pos); timestampnow = new Timestamp(current.getTime()); return timestampnow; } catch (NullPointerException e) { return null; } }