Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incorrect Date Exception

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'
like image 628
Simran Avatar asked Aug 12 '10 09:08

Simran


1 Answers

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

like image 121
Dubas Avatar answered Oct 22 '22 05:10

Dubas