Reputation: 141
I use a PostgreSQL and ORM Sequelize database. And I want to change the date format from YYYY-MM-DD
to DD.MM.YYYY
. Is it possible to do this?
...
date_work: {
type: Sequelize.DATEONLY,
required: true
},
...
Upvotes: 2
Views: 6705
Reputation: 566
You can do it using Moment like
sequelize.define('TableName', {
DateTime: {
type: DataTypes.DATEONLY,
get: function() {
return moment(this.getDataValue('DateTime')).format('DD.MM.YYYY')
}
}
}
Upvotes: 5