AvnerSo
AvnerSo

Reputation: 1727

What is the exact maximum value for TIMESTAMP in MySQL?

The documentation states that -

the range for TIMESTAMP values is '1970-01-01 00:00:01.000000' to '2038-01-19 03:14:07.999999'

But when I get this when I try to enter the maximum value:

mysql> insert into integration_table (`TIMESTAMP`) VALUES ('2038-01-19 03:14:07.999999');
ERROR 1292 (22007): Incorrect datetime value: '2038-01-19 03:14:07.999999' for column 'TIMESTAMP' at row 1

If I incrementally decrease the value, the maximum value that will work is '2038-01-19 03:14:07.499999'

I know that MySQL supports microseconds since version 5.6.4, so that's not the issue.

Am I misunderstanding something or is this some configuration issue?

Thanks

Upvotes: 2

Views: 3223

Answers (1)

AvnerSo
AvnerSo

Reputation: 1727

Defining the column as TIMESTAMP means it does not support microseconds, so .5 and above will be rounded up, which makes this value out of range.

The column needs to be defined as TIMESTAMP(6) to support 6 digit microseconds.

Upvotes: 3

Related Questions