Home >Database >Mysql Tutorial >mysql保存当前时间精确到秒_MySQL

mysql保存当前时间精确到秒_MySQL

WBOY
WBOYOriginal
2016-05-31 08:48:552548browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn