ER_TRUNCATED_WRONG_VALUE: Incorrect datetime value : <p>So i've recently completed an application for a study project. It's all good, and all I have left is putting the application to production.</p>

<p>I'm using MySQL with Node.js(I know, we don't like that, but someone's gotta try it). I have a socket that adds a chat message to the mysql Message Table, which contains the text, date time etc. The date time is set to <code>new Date()</code>.</p>

<p>Now as I placed the application in a production server(reinstalling dependencies, mysql etc.), I suddenly get this error when I write messages:</p>

<pre><code>Error: ER_TRUNCATED_WRONG_VALUE: Incorrect datetime value: '2017-06-01T09:45:06.253Z' for column 'message_datetime' at row 1
</code></pre>

<p>I did not get that error in development, so I asked myself if I downloaded different versions of mysql... and I did:</p>

<p><strong>Development:</strong></p>

<pre><code>mysql  Ver 14.14 Distrib 5.5.54, for debian-linux-gnu (i686) using readline 6.3
</code></pre>

<p><strong>Production</strong></p>

<p><code>mysql  Ver 14.14 Distrib 5.7.18, for Linux (x86_64) using  EditLine wrapper</code></p>

<p>and the message table looks like this:</p>

<p><code>CREATE TABLE message (
    message_id INT AUTO_INCREMENT,
    message_sender_id VARCHAR(80) NOT NULL,
    message_datetime DATETIME,
    message_text TEXT,
    message_chat_id INT NOT NULL,
    PRIMARY KEY(message_id),
    FOREIGN KEY(message_chat_id) REFERENCES chat(id)
    ON DELETE CASCADE
) ENGINE=InnoDB;</code></p>

<p>So what are the differences? Why is <code>'yyyy-mm-ddThh:mm:ss.%%%Z'</code> suddenly not a valid date format? How do I fix this? </p>

<p>Thankful for any help!</p>
