转换unix timestamp成postgresql timestamp

27 十二月, 2006 (10:30) | postgresql, python

unix的timestamp是一组数字,表示从1970年1月1日以来的秒数。在postgresql里面可以用下面的方法轻松转换成表示时间的timestamp类型:
select timestamp '1970-01-01' + interval '953559481 seconds';

参考自这里

python下time.time()返回unix timestamp,可以用calendar.timegm()转换成tuple。

Write a comment





提示:如果你刚刚提交过评论,但是还没有被显示出来,请点击这里刷新一下: 刷新评论