关于mysql中的now()
我用sql在表中加入一组数据,date由now()取值。
代码如下:
insert into `inputtest`(`id`, `uid`, `content`, `date`) values (,leo,hello,now())
代码运行:
8 leo hello 0000-00-00 00:00:00
为什么now()的数值全是0000-00-00 00:00:00
------解决思路----------------------
设置时区了么?
------解决思路----------------------
修改一下 insert 语句:
insert into `inputtest`(`id`, `uid`, `content`, `date`) values (,leo,hello,now());
now()是函数,不用加引号,加了变成插入字符串,日期类型字段就会显示0000-00-00 00:00:00