sequelize datetime format 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: sequelize date format
function getDateWithoutTime(date) {
return require('moment')(date).format('YYYY-MM-DD');
}