postgresq与中timestampdiff(SECOND,字段,NOW())相同求时间差值的秒值
 
mysql中写法:
 
select timestampdiff(SECOND,createtime,NOW()) from table1;

postgresql:

select extract(epoch FROM CURRENT_TIMESTAMP) - extract(epoch FROM createtime) from table1;

 

 
表:table1
 
字段:createtime
 
求创建时间与当前时间之间的差值转换成秒值。