https://blog.csdn.net/chanlingmai5374/article/details/93190983

 

1、问题场景

数据库里存了 datetime。但 Node 查询出来是这样子的:

2019-05-14T21:40:59.000Z

2、解决办法

这是 Mysql时区 与 Node时区 不一致导致的。
解决方法:配置Node数据库连接。
加上 timezone 这一行:

client: {

host: '***.***.***.***',

port: '****',

user: '****',

timezone: "08:00"

}

3、重新尝试

Node 查询,得到结果:

2019-05-15 05:40:59

返回正常。收工!

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2022-02-09
  • 2021-04-24
  • 2022-02-09
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2021-11-18
  • 1970-01-01
  • 2022-12-23
相关资源
相似解决方案