【问题标题】:SQL query to update to current timezone更新到当前时区的 SQL 查询
【发布时间】:2017-10-04 00:32:11
【问题描述】:

我正在使用 rails5/postgres。目前,created_at 和 updated_at 是 UTC,我如何使用 SQL 查询将其更新到本地时区,比如澳大利亚悉尼。另外,我想在 postico 中运行脚本。

【问题讨论】:

  • 你已经有一些代码了吗?什么是创建归档?你通过postgres?其他任何类型的应用程序?

标签: sql postgresql ruby-on-rails-5 postico


【解决方案1】:

update table_name set created_at = created_at + 10 * interval '1 hour'; update table_name set updated_at = updated_at + 10 * interval '1 hour';

发现上面的命令会更新表时间戳。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-05
    • 2015-09-26
    相关资源
    最近更新 更多