Salar
Salar

Reputation: 5509

MariaDB ER_TRUNCATED_WRONG_VALUE: Incorrect datetime value for values before 1970-01-01 00:00:00

This is the short version of my table schema.

CREATE TABLE `users` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `birthday` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

I can't insert time values before 1970-01-01 00:00:00. I get this error: ER_TRUNCATED_WRONG_VALUE: Incorrect datetime value: '1964-02-19 16:57:55' for column 'birthday.

How can I fix that?

This is my server version.
enter image description here

Upvotes: 0

Views: 4453

Answers (1)

Salar
Salar

Reputation: 5509

According to Mysql Documentation, TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.
To solve the problem, I changed the column from TIMESTAMP to DATETIME.

Upvotes: 4

Related Questions