Incorrect datetime value: '' for column 'examDate' at row 1
出问题的程序:
user.setCreateTime(new Date());
控制台图片一张,问题是:Incorrect datetime value: '' for column 'createTime' at row 1
解决方案:
import java.text.SimpleDateFormat; import java.util.Date; import java.sql.Timestamp; //取当前时间 Date nowdate=new Date(); //转换时间格式 SimpleDateFormat simpleDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); user.setCreateTime(Timestamp.valueOf(simpleDate.format(nowdate)));
原文链接:https://blog.csdn.net/helijie92902/article/details/53054199/