去掉yyyy-MM-dd HH:mm:ss后的小数点,代码如下
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private Date covertTime(Date date) {
Timestamp now = new Timestamp(date.getTime());
String str = df.format(now);
Date newDate = null;
try {
newDate = df.parse(str);
} catch (ParseException e) {
throw new BusinessException("转换日期去掉毫秒异常");
}
return newDate;
}