List:General Discussion« Previous MessageNext Message »
From:Nick Khamis Date:August 21 2013 10:03pm
Subject:Java UTC Calendar and Mysql TimeStamp - Gets me every time!!!!!
View as plain text  
Hello Everyone,

We have the following mysql timetampe field

startdate | timestamp | NO   |     | 0000-00-00 00:00:00

When trying to insert a long value in there:

Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
c.getTimeInMillis();

We are presented with the following error:

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect
datetime value: '1377119243640' for column 'stopdate' at row 1


Our environments is:

JDBC Driver = 5.1.26
Mysql = 5.5


show variables like 'time_zone%';
+---------------+--------+
| Variable_name | Value  |
+---------------+--------+
| time_zone     | +00:00 |
+---------------+--------+

SELECT @@global.sql_mode;
+-------------------+
| @@global.sql_mode |
+-------------------+
|                   |
+-------------------+

Not sure why I am getting this error.


Thanks in Advance,

Nick.

Thread
Java UTC Calendar and Mysql TimeStamp - Gets me every time!!!!!Nick Khamis21 Aug
  • Re: Java UTC Calendar and Mysql TimeStamp - Gets me every time!!!!!Michael Dykman21 Aug
  • Re: Java UTC Calendar and Mysql TimeStamp - Gets me everytime!!!!!hsv22 Aug
    • Re: Java UTC Calendar and Mysql TimeStamp - Gets me every time!!!!!Nick Cameo22 Aug
      • Re: Java UTC Calendar and Mysql TimeStamp - Gets me everytime!!!!!hsv23 Aug
    • Re: Java UTC Calendar and Mysql TimeStamp - Gets me every time!!!!!Nick Cameo22 Aug