MySQLMySQL 1292

MySQL 1292: Incorrect Datetime Value

MySQL 1292 is thrown when a string value cannot be parsed as a valid DATE, DATETIME, or TIMESTAMP. Strict SQL mode rejects invalid date literals entirely.

Example Query

INSERT INTO events (event_date) VALUES ('2024-13-01');
-- Month 13 does not exist

Common Causes

  1. 1Date string in wrong format (DD/MM/YYYY instead of YYYY-MM-DD)
  2. 2Out-of-range values such as month 13 or day 32
  3. 3Passing an empty string '' to a NOT NULL datetime column in strict mode

How to Fix It

Ensure date strings follow the ISO 8601 format YYYY-MM-DD. Use STR_TO_DATE() to convert non-standard formats. Check that your application locale does not reorder date components.

Need a reliable database?

Try Supabase — free PostgreSQL with a generous free tier. No credit card required.

Get started free →

Got a query causing this error?

Paste it into SQLbuddy and get an instant plain-English explanation with optimization tips.

Analyze My Query →