node mysql 时间格式问题
使用 mysql模块连接数据库,表中有一个名称字段的类型为时间戳,该字段中存储的数据格式为:
2021-05-16 14:59:18
但是当我通过 Node.JS 检索相同的数据时,数据在浏览器中显示为:
Fri Jun 08 2021 15:16:50 GMT+0530
解决方法
更改mysql配置:
dateStrings: true,
host: 'localhost',
user: 'root',
password: '123',
database: 'goods'