1

How to format the datetime in the raw query, my database is mysql. The format i want is YYYY-MM-DD HH:mm:SS, but now it is YYYY-MM-DDTHH:mm:ss:000Z.

1 Answers1

-1

In defaults option, Sequelize return UTC format.

If you want to change it to YYYY-MM-DD HH:mm:ss add dateStrings: true in dialectOptions

example :

const options = {
    host: process.env.MYSQL_HOST,
    port: process.env.MYSQL_PORT,
    dialectOptions: {
        dateStrings: true
    }
    logging: true
};
const sequelize = new Sequelize(process.env.MYSQL_NAME, process.env.MYSQL_USER, process.env.MYSQL_PASS, options);