Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k views
in Technique[技术] by (71.8m points)

SQLyog时间类型date插入值时提示incorret time value?

表里面有一个字段addTime, 希望是日期或者时间戳类型,我尝试用date, timestamp两种类型,插入时都会报错。我是用SQLyog给表里面直接插入数据的。比如我用date类型时,报错信息如下:

Incorrect time value: '2020-11-22' for column 'addTime' at row 1

773d74a2e32b43c114dd6dd50f8d11d.png

我搜了一下好像格式没错,不知道哪里错了
9d7e0c8f73cfc8dee40fca9777a97cf.png

请问date类型正确的应该是什么格式呢?以前没接触过数据库,烦请赐教,谢谢谢谢


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

把问题发出来就突然知道怎么回事了……是因为我修改类型的时候,表里面还有值,所以修改类型没成功,还是time类型。我把表里面的数据删了之后,再把addTime字段修改成date类型,就没有报错了。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...