Nick,

You should have answered your own question in the text.

The MySql TIMESTAMP type is, as all other timestamps in the *nix
world, a count of seconds since epoch time.  The Java function you are
using yields MILLI-seconds.  Divide it by 1000 and you should be good
to go.


On Wed, Aug 21, 2013 at 6:03 PM, Nick Khamis <sym...@gmail.com> wrote:
> 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.



-- 
 - michael dykman
 - mdyk...@gmail.com

 May the Source be with you.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

Reply via email to