title: Sequelize How do you format date to YYYY-MM-DD HH:mm:ss and keep the columns as snake case
body: <p>Hi I am using Sequelize with a Postgres Database</p>
  <p>So I am trying to format date on the sequelize createdAt and updatedAt columns as <code>YYYY-MM-DD HH:mm:ss</code> As well as keeping the columns as snake_case not camelcase so they would be <code>created_at</code> and <code>updated_at</code>How can I achieve this? I have tried the following:</p>
  <pre><code>    createdAt: {
        type: DataTypes.DATE,
        allowNull: false,
        defaultValue: moment.utc().format('YYYY-MM-DD HH:mm:ss'),
        field: 'created_at'
      },
  </code></pre>
  <p>or</p>
  <pre><code>    createdAt: {
        type: DataTypes.DATE,
        defaultValue: sequelize.NOW,
        set(value) {
          return value.toISOString().replace(/\..+/g, '')
  // coming in the db as 2021-10-31 01:34:48.81+00 so wanted to remove evrything after the dot
        },
        name: 'createdAt',
        field: 'created_at',
      },
  </code></pre>
  <p>Is not working and I am getting this error</p>
  <pre><code>          throw new Error(`Value for &quot;${key}&quot; option must be a string or a boolean, got ${typeof this.options[key]}`);
            ^
  
  Error: Value for &quot;createdAt&quot; option must be a string or a boolean, got object
  </code></pre>
  <p>Here is the whole table defined above is what I have pinpointed which I need help with</p>
  <pre><code>  const Supplier = sequelize.define('Supplier', {
      id: {
        type: DataTypes.UUID,
        defaultValue: DataTypes.UUIDV4,
        allowNull: false,
        primaryKey: true
      },
      name: {
        type: DataTypes.STRING,
        allowNull: false,
        unique: true,
        validate: {
          len: [1, 50]
        }
      },
      description: {
        type: DataTypes.STRING,
        allowNull: true,
      },
    }, {
      tableName: 'suppliers',
      timestamps: true,
      createdAt: {
        type: DataTypes.DATE,
        defaultValue: sequelize.NOW,
        set(value) {
          return value.toISOString().replace(/\..+/g, '')
        },
        name: 'createdAt',
        field: 'created_at',
      },
      updatedAt: {
        type: DataTypes.DATE,
        defaultValue: sequelize.NOW,
        set(value) {
          return value.toISOString().replace(/\..+/g, '')
        },
        field: 'updated_at',
      },
      // freezeTableName: true
      // paranoid: true
    });
  </code></pre>
  <p>Thanks</p>
  <p>Today Sequelize docs is not working here is a webarchive's for it</p>
  <p><a href="https://web.archive.org/web/20200731154157/http://sequelize.org/master/index.html" rel="nofollow noreferrer">https://web.archive.org/web/20200731154157/http://sequelize.org/master/index.html</a></p>