1model.findAll({
2 attributes: [
3 'id',
4 [sequelize.fn('date_format', sequelize.col('date_col'), '%Y-%m-%d'), 'date_col_formed']
5 ]})
6 .then(function(result) {
7 console.log(result);
8 });
9
1function getDateWithoutTime(date) {
2 return require('moment')(date).format('YYYY-MM-DD');
3}
1/*
2 * Copy this file to ./sscce.js
3 * Add code from issue
4 * npm run sscce-{dialect}
5 */
6
7var Sequelize;
8var DataTypes = Sequelize = require('./index');
9var sequelize = require('./test/support').createSequelizeInstance({
10 logging: console.log
11});
12
13var Topic = sequelize.define('topic', {
14 last_date_time: {
15 type: Sequelize.DATE,
16 allowNull: false,
17 defaultValue: Sequelize.NOW
18 }
19});
20
21return sequelize.sync({
22 force: true
23}).then(() => {
24 return Topic.update(
25 {
26 last_date_time: '2016-08-09 04:05:02',
27 },
28 {
29 where: {id: 42}
30 }
31 );
32})