【发布时间】:2021-06-02 16:27:13
【问题描述】:
如何在 created_at 行中仅存储 IST 时间值(如 HH:MM),从 timestamp 生成的值采用 UTC 和 DATE+TIME 格式
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');
});
};
【问题讨论】:
-
您想在 IST 时区中只保存 HH:MM 还是同时保存日期和时间?
-
@fortunee 仅 HH:MM 时间
-
你在使用 MySQL 还是 Postgres 什么数据库?
-
哎呀我现在看到了,你正在使用 sqlite
-
您可能想考虑使用
moment.format()功能
标签: mysql node.js sqlite knex.js