How to update Sequelize.DATE TYPE?
See original GitHub issue last_date_time: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.NOW
}
I use momentjs to get the time
But when I update the last_date_time
,
sequelize just Executing (default): UPDATE
topicsSET
updatedAt='2016-08-09 07:42:28' WHERE
id= '53'
I tried some format,all the same
(new Date()).format('yyyy-MM-dd hh:mm:ss')
moment().format('yyyy-MM-dd hh:mm:ss')
moment.utc().format()
Sequelize.NOW
Topic.update(
{
last_data_time: Sequelize.NOW,
},
{
where: {id: id}
}
);
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Data Types
To access a built-in data type, you must import DataTypes : ... DATE(6), TIMESTAMP(6) WITH TIME ZONE, DATETIME(6), DATETIME(6), DATETIMEOFFSET(6), TEXT ...
Read more >Sequelize - how to format the date for date types values
First, create a Sequelize model of the above table. The invoiceDate column uses the DATEONLY type while paymentDate column uses DATE type as ......
Read more >How to update with Sequelize with 'NOW()' on a timestamp?
You can use Sequelize.fn to wrap it appropriately: instance.updateAttributes({syncedAt: sequelize.fn('NOW')});.
Read more >sequelize-typescript
In order to update the types for sequelize please go to the Definitely Typed repo, it would also be a good idea to...
Read more >sequelize.SequelizeStatic.DATE JavaScript and Node.js ...
value: DataTypes.INTEGER, updated_at: DataTypes.DATE. ... BOOLEAN, defaultValue: true }, sequence: { type: Sequelize.INTEGER, defaultValue: 0, trim: true } ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@janmeier It worked. I changed nothing. I’m happy. Thank you for your answer. I will close this issue.