java 插入时间 到mysql

两种都可以  sql  update xx set  update=#{updated_time};

String myTime ="2018-12-17 10:10:10";
SimpleDateFormat SimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
updateParam.put("updated_time",SimpleDateFormat.parse(myTime));

或者:

String myTime ="2018-12-17 10:10:10"; SimpleDateFormat SimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); updateParam.put("updated_time",new java.sql.Timestamp(SimpleDateFormat.parse(myTime).getTime()));

猜你喜欢

转载自blog.csdn.net/zhuchunyan_aijia/article/details/85075781
今日推荐