日期异常不正确 [英] Incorrect Date Exception
本文介绍了日期异常不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
com 我正在尝试使用java在sql中输入1900年的日期, .mysql.jdbc.MysqlDataTruncation:数据截断:datetime值不正确:'1900-01-01 00:00:00'
解决方案
如果您使用 TIMESTAMP 存储日期,则最小值为 1970-01-01 00:00:01 '。
使用 DATE 存储较旧的日期或 DATETIME 以存储较旧的日期。 / p>
检查MySQL文档中的日期格式 http://dev.mysql.com/doc/refman/5.1/en/datetime.html
I am trying to enter a date with year 1900 using java into sql, but I am getting exception as :
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '1900-01-01 00:00:00'
解决方案
If you are using TIMESTAMP to store the dates the minimal value is '1970-01-01 00:00:01'.
Use DATE to store older dates or DATETIME to store older dates with time.
Check the MySQL documentation about the date format http://dev.mysql.com/doc/refman/5.1/en/datetime.html
这篇关于日期异常不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文