Skip to content

Instantly share code, notes, and snippets.

@smolijar
Last active November 20, 2018 16:31
Show Gist options
  • Save smolijar/d62bb1afdbd1e47b6b081bc1cd976159 to your computer and use it in GitHub Desktop.
Save smolijar/d62bb1afdbd1e47b6b081bc1cd976159 to your computer and use it in GitHub Desktop.
[TZ dates in MySQL]

Timezoned dates in MySQL 🐬

Problem 😿

Error: ER_TRUNCATED_WRONG_VALUE: Incorrect datetime value: '2017-10-10T06:50:04.006Z' for column 'created_at' at row 1

Solution 😺

MySQL config, e.g.: /etc/mysql/my.cnf

[mysqld]
sql-mode="NO_ENGINE_SUBSTITUTION" # default is "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"

(this is for mysql ^5.7.8, for older see link)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment