Invalid date exception

I am trying to enter a date from 1900 using java in sql, but I am getting an exception like:

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '1900-01-01 00:00:00'
+3
source share
1 answer

If you use TIMESTAMP to save dates, the minimum value is " 1970-01-01 00:00:01 ".

Use DATE to store old dates or DATETIME to store old dates over time.

Check MySQL documentation for date format http://dev.mysql.com/doc/refman/5.1/en/datetime.html

+11
source

Source: https://habr.com/ru/post/1759288/


All Articles