MySQL Forums
Forum List  »  Connector/Node.js

Dates being returned in the wrong timezone
Posted by: Lawrence Marigold
Date: November 24, 2020 10:58AM


I'm using version 8.0.22 of @mysql/xdevapi on node.js 9.5.

The Mysql server is version 8.0.22 on Windows 2012.

The timezone of the server and the mysql service are set to +01:00, as is the server where node is running.

When I do a "SELECT NOW()" query however the time is set to an hour later than it should be, even though the zone is correctly specified as "+0100" in the returned date object.

Dates stored in datetime columns are also being returned with an hour added.

I can only assume that the connector is assuming the dates coming from the server are in UTC and is therefore adding an hour.

Is there anything I can do to fix this behaviour, short of subtracting an hour for every query?

I thought about changing all the times stored on the server to UTC, but then whenever I do a local query I'll needed to convert to our local timezone, which will lead to errors and of course "SELECT NOW()" will still be wrong.

I'd be grateful for any assistance.

Thanks - Lawrence

Options: ReplyQuote

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.