【发布时间】:2018-04-26 09:08:57
【问题描述】:
我需要选择昨天的所有记录。表中的日期存储为纪元时间戳。我尝试了类似的方法,但它不起作用。
select to_char((SELECT TIMESTAMP WITH TIME ZONE 'epoch' + history.clock * INTERVAL '1 second') , 'YYYY-MM-DD HH24:MI:SS ') AS Data
from history
WHERE
history.clock >= EXTRACT( epoch FROM current_timestamp - interval '1 day') and
history.clock <= EXTRACT( epoch FROM current_timestamp - interval '1 day') ;
【问题讨论】:
-
“它不工作”是什么意思?引发错误?结果不正确?请使用示例数据和预期结果编辑您的问题。
-
我没有给出任何结果。 Scoots 帮助 mi 现在。
标签: postgresql date epoch