September 23, 2020

WeAnswer

The complete guide to the beginners as well as to the experienced Web Developers

Incorrect datetime value: ‘0000-00-00 00:00:00’ for column

When we trying update the scheme of database structure then get error Incorrect datetime value: ‘0000-00-00 00:00:00’ for the column.

Follow Below Steps

  • Get SQL_MODE :SHOW VARIABLES LIKE ‘sql_mode’;

Result:
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

  • Remove on the result :NO_ZERO_IN_DATE,NO_ZERO_DATE
  • Set new configuration :set GLOBAL SQL_MODE=’ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION’