sequelize时间格式化
Others 2020-09-18 02:03:26 2020-09-18 02:03:26 1860 次浏览初始化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' //改为标准时区
}
);
Links: 478