sequelize date time code example

Example 1: sequelize date format

model.findAll({
  attributes: [
      'id',
      [sequelize.fn('date_format', sequelize.col('date_col'), '%Y-%m-%d'), 'date_col_formed']
  ]})
  .then(function(result) {
    console.log(result);
  });

Example 2: time sequelize

date: {
        type: DataTypes.DATEONLY(),
        allowNull: false,
        set (valueToBeSet) { 
            this.setDataValue('date', valueToBeSet)
        }
    },
    timeFrom: {
        type: DataTypes.TIME,
        allowNull: false,
        set (valueToBeSet) { 
            this.setDataValue('timeFrom', valueToBeSet)
        }
    },
    timeTo: {
        type: DataTypes.TIME,
        allowNull: false,
        set (valueToBeSet) { 
            this.setDataValue('timeTo', valueToBeSet)
        }
    },