mysql保存当前时间精确到秒

时间:2014-07-02 15:15:37   收藏:0   阅读:300

   用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}



mysql保存当前时间精确到秒,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!