postgresql获取Unix时间戳

前端之家收集整理的这篇文章主要介绍了postgresql获取Unix时间戳前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

-- timestamp to unix timestamp

select now(),EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE 'now()')::int as ext,extract(epoch FROM now())::int,CURRENT_TIMESTAMP,date_part('epoch',CURRENT_TIMESTAMP)::int

-- unix timestamp to timestamp

SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 982384720.12 * INTERVAL '1 second';

--SELECT TIMESTAMP WITH TIME ZONE 'epoch' + extract(epoch FROM now())* INTERVAL '1 second';

原文链接:https://www.f2er.com/postgresql/194275.html

猜你在找的Postgre SQL相关文章