How can i store only IST time values like HH:MM in created_at row, values generated from timestamp
are in UTC and DATE+TIME format
exports.up = function(knex) {
return knex.schema.createTable('tbl_xyz', (table) => {
table.increments('id').primary();
table.timestamp('created_at').defaultTo(knex.fn.now());
table.string('date');
table.string('url');
table.string('tags');
});
};
Try with date-fns
:
const dateFns = require("date-fns")
Then, on table def:
table.timestamp('created_at').defaultTo(dateFns.format(knex.fn.now(), 'hh:mm'))