Use node to query the database (mysql) time type field to return the wrong date format solution

1. Problems

The time of the database is 2022-11-04 17:15:52, but the data queried by SQL is 2022-11-04T09:15:52.000Z

Two, the reason

Check the information and find out that this is caused by the inconsistency between the Mysql time zone and the Node time zone

Three, solve

Just add timezone: "08:00" to the database configuration file and restart it. No need to manually convert time format
insert image description here

Guess you like

Origin blog.csdn.net/qq_45791799/article/details/127693771