【问题标题】:Convert Unix timestamp to timestamp without time zone将 Unix 时间戳转换为没有时区的时间戳
【发布时间】:2017-04-25 09:38:45
【问题描述】:

如何将 Unix 时间戳(或纪元时间)转换为 PostgreSQL timestamp without time zone

例如,1481294792 应转换为 2016-12-09 14:46:32

我尝试了SELECT to_timestamp(1481294792)::timestamp,但这给了我2016-12-09 09:46:32

【问题讨论】:

    标签: postgresql timestamp unix-timestamp epoch


    【解决方案1】:
    SELECT to_timestamp(1481294792) AT TIME ZONE 'UTC';
    

    来源:https://dba.stackexchange.com/a/61345/33877

    【讨论】:

      猜你喜欢
      • 2015-10-07
      • 2013-05-20
      • 2013-04-07
      • 1970-01-01
      • 2020-10-19
      • 1970-01-01
      • 2023-03-18
      • 2018-12-18
      • 1970-01-01
      相关资源
      最近更新 更多