What is your original format? YYYY-MM-DD HH:mm:ss ???
const model = sequelize.define('model', {//columns specifications
createdAt: {
type : TYPE.DATE,
allowNull : false,
get() {
const createAt = this.getDataValue('createAt')
// createAt is an instance of date, you could operate it with moment library
// to get ur format
return createAt
},
set(createAt) {
return this.setDataValue('createAt',createAt)
}
}
}, {
// options
timestamps: true // the createdAt and updatedAt will be stored by YYYY-MM-DD HH:mm:ss
});
If all your CRUD operations on the database are done through sequelize, there should be no problem
new Date("Tue Mar 14 2017 16:02:21 GMT+0800 (China Standard Time)").getTime()
What is your original format?
YYYY-MM-DD HH:mm:ss
???If all your CRUD operations on the database are done through sequelize, there should be no problem