Incorrect Date Exception

后端 未结 1 1205
长情又很酷
长情又很酷 2021-01-13 10:26

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: Incorre         


        
相关标签:
1条回答
  • 2021-01-13 10:40

    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

    0 讨论(0)
提交回复
热议问题