SQL-ZERO-DATE-001
'0000-00-00 00:00:00'
0000-00-00 dates
MySQL strict mode (the Joomla 4+ default) rejects the zero date. Inserts and upgrades fail with Incorrect DATETIME value.
'0000-00-00 00:00:00' → NULL
What you will see
- Incorrect DATETIME value: '0000-00-00 00:00:00'
- Incorrect DATE value: '0000-00-00'
Symptoms people search
cannot save article · install sql fails on mysql 8 · zero date
Replace this code
Swap '0000-00-00 00:00:00' for NULL.
Joomla 3
Remove or stop calling this
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00'Joomla 4 / 6
Use this instead
`created` datetime NULL DEFAULT NULLHow to fix it
- 1Change columns to NULL default NULL.
- 2Stop writing '0000-00-00' from PHP — use null.
- 3UPDATE existing rows to NULL before the schema change if needed.
Also known as
0000-00-00 · zero date · invalid datetime
Related issues
- Joomla 3 → 4SQL / schema
MyISAM engine in install SQL
ENGINE=MyISAM → ENGINE=InnoDB
- Joomla 3 → 4SQL / schema
SQL Server driver
sqlsrv → MySQL / MariaDB / PostgreSQL
- Joomla 3 → 4SQL / schema
DROP TABLE without IF EXISTS
DROP TABLE `#__lms_old`; → DROP TABLE IF EXISTS `#__lms_old`;
- Joomla 3 → 4SQL / schema
utf8 (3-byte) instead of utf8mb4
DEFAULT CHARSET=utf8 → DEFAULT CHARSET=utf8mb4