MyBatis对此,会自动转化
以下是Java代码手动转化
Date d = new Date();
System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(d));
Timestamp ts = new Timestamp(d.getTime()); //Date to Timestamp
System.out.println(ts.toString());
2018-04-20 15:25:25.638
2018-04-20 15:25:25.638
网友评论