SimpleDateFormat非线程安全!
SimpleDateFormat非线程安全!牢记!
?
以后还要记得任何static变量与方法都要注意是否线程安全。
?
//private static final SimpleDateFormat dateFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static Date getDate(String dateStr){try {SimpleDateFormat dateFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");return dateFmt.parse(dateStr);} catch (ParseException e) {//e.printStackTrace();}return null;}