how to format Knex.js timestamps
I have the next table:
knex.schema.hasTable('notes').then(function (exists) {
if (!exists) {
return knex.schema.createTable('notes', function (t) {
t.increments('id').primary();
t.string('title', 100).notNullable();
开发者_开发技巧 t.string('content', 300).notNullable();
t.boolean('archived').notNullable().defaultTo(false);
t.timestamp('updated_at').defaultTo(knex.fn.now());
}).then(() => {
console.log('* Table created "notes"')
}).catch((err) => {
console.log(err)
throw err
});
}
});
It returns the timestamp in this format: YYYY-MM-DDTHH:MM:SS.000Z and i want it in this one: YYYY-MM-DD HH:MM
I tried searching for a solution but didn't find one
精彩评论