伙计们,我在我的 MySQL 数据库中存储了 unix 时间戳,我在其中使用 MySQL 函数 FROM_UNIX()
读取它们。
现在我正在将数据库从 MySQL 迁移到 PostgreSQL。在 PostgreSQL 中,如何读取 unix 时间戳,就像在 MySQL 中使用 FROM_UNIX()
一样?
最佳答案
采取 from the manual :
to_timestamp(double precision) convert Unix epoch to time stamp
如果您需要部分创建的时间戳,请使用 extract
功能
select extract(year from to_timestamp(1284352323))
关于postgresql - FROM_UNIX 在 PostgreSQL 中的替代,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12194416/