Migrating timezone timestamps
0
votes
1
answer
111
views
I am trying to migrate this node library https://github.com/LocalSEOGuide/lighthouse-reporter from Postgres to MySQL and getting an error
error: ER_TRUNCATED_WRONG_VALUE: Incorrect datetime value: '2020-03-22T20:38:48.347Z' for column 'fetch_time' at row 1
I've isolated the query where the error happens and built a little test:
await db.query('drop table test');
await db.query(`CREATE TABLE IF NOT EXISTS
test(
id SERIAL PRIMARY KEY,
fetch_time datetime
);
`);
const query_text = "INSERT INTO test SET ?"
const query_params = { "fetch_time":"2020-03-22T20:38:48.347Z" }
await db.query(query_text, query_params);
It seems that the reporter is returning a timestamp with a Z at the end, but i cant figure out how to get it properly stored in to mysql. Any suggestions would be very helpful!
I've also tried with fetch_time as a timestamp
Asked by fotoflo
(101 rep)
Mar 22, 2020, 09:38 PM
Last activity: Mar 23, 2020, 09:01 AM
Last activity: Mar 23, 2020, 09:01 AM