1. Date is stored in the database.
2020-05-15
Copy the code
But Node looks like this:
The 2020-05-14 T16:00:00. 000 zCopy the code
The Mysql time zone is inconsistent with the Node time zone. Solution: Configure the Node database connection. Add the line timezone:
client: {
host: '* * *. * * *. * * *. * * *',
port: '* * * *',
user: '* * * *',
timezone: "08:00"
}
Copy the code
3, try the Node query again and get the result:
2020-05-15
Copy the code