mysql保存当前时间精确到秒

   用mybatis在mysql中保存字段精确到秒须要两个步骤。

1、如今mysql中将时间字段改为datetime 比如:alter table tablename add pay_date datetime comment '精确到秒的时间'

2、在sql语句中直接用now().  比如:        update tj_record set   is_customerHandover ='1' and customer_handover_date = now() where id = #{record_id}



猜你喜欢

转载自www.cnblogs.com/ldxsuanfa/p/10842351.html