【问题标题】:Converting float to timestamp in Postgresql using Peewee使用 Peewee 在 Postgresql 中将浮点数转换为时间戳
【发布时间】:2018-07-18 09:43:23
【问题描述】:

我很难在 Postgress 中将浮点列值转换为时间戳。实际上,在 SQL 中是这样的:

TIMESTAMP 'epoch' + "t1"."timestamp" * INTERVAL '1 second') at time zone 'UTC'

你能帮我用 Peewee ORM 表达同样的意思吗?

【问题讨论】:

    标签: postgresql orm peewee datetime-conversion


    【解决方案1】:

    为什么不:

    SELECT to_timestamp(t1.timestamp);
    

    看起来这会起作用......在peewee中:

    SomeModel.select(fn.to_timestamp(SomeModel.timestamp))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-17
      • 2013-02-08
      • 2020-08-03
      • 2018-12-23
      • 1970-01-01
      • 1970-01-01
      • 2011-12-30
      相关资源
      最近更新 更多