每次查询datetime的字段,显示出来都是这种格式
2019-08-27T12:02:05.000Z
初始化Sequelize的时候传入dialectOptions参数
let sequelize = new Sequelize( config.MYSQL_OPTIONS.database, config.MYSQL_OPTIONS.user, config.MYSQL_OPTIONS.password, { host: config.MYSQL_OPTIONS.host, port: config.MYSQL_OPTIONS.port, dialect: 'mysql', dialectOptions: { dateStrings: true, typeCast: true }, pool: { max: 5, min: 0, acquire: 30000, idle: 10000 }, timezone: '+08:00' //改为标准时区 } );
来源:博客园
作者:雪山飞猪
链接:https://www.cnblogs.com/chenqionghe/p/11430335.html