Answers for "sequelize date functions"

2

sequelize order by date

Users.findAll({ order: [['updatedAt', 'DESC']]}); // or ASC
Posted by: Guest on March-23-2021
0

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);
  });
Posted by: Guest on May-18-2021
0

sequelize date format

function getDateWithoutTime(date) {
    return require('moment')(date).format('YYYY-MM-DD');
}
Posted by: Guest on December-20-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language