【问题标题】:postgres timestamp extract date from bigint datatypepostgres时间戳从bigint数据类型中提取日期
【发布时间】:2016-04-21 09:49:58
【问题描述】:

我使用 php 将日期(时间戳 unix 格式)插入到 postgres 表中。下面是字段结构。

last_dwnld
(bigint)
-----------
1408788007
1408190322

字段数据类型为bigint,包含时间戳。字段名称是 last_dwnld。

请告诉我如何使用 postgres 查询提取日期。 last_dwnld::DATE 在这里没有帮助。

【问题讨论】:

  • 考虑将该列转换为时间戳列。

标签: php postgresql


【解决方案1】:

Postgres 的内部 to_timestamp 函数处理这个(从 8.1 开始)

Select to_timestamp(1408788007); -- 2014-08-23 10:00:07+00

【讨论】:

    猜你喜欢
    • 2013-10-30
    • 1970-01-01
    • 1970-01-01
    • 2018-07-18
    • 2015-11-13
    • 2015-06-18
    • 2017-02-01
    • 1970-01-01
    相关资源
    最近更新 更多