java 字符串转日期格式
/** * 字符串转日期格式 * */ 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; } }
本文来自博客园,作者:可可西里(lemon),转载请注明原文链接:https://www.cnblogs.com/ldl326308/p/9600796.html