sql语句
SELECT EXTRACT(EPOCH FROM (TIMESTAMP '2017-12-16 12:21:13'- TIMESTAMP '2017-12-15 12:21:00'));
=>
86413
计算两个时间的差值更新另一个时间字段
UPDATE your_table
SET this_time=(EXTRACT(EPOCH FROM (time_a-time_b)));
SELECT EXTRACT(EPOCH FROM (TIMESTAMP '2017-12-16 12:21:13'- TIMESTAMP '2017-12-15 12:21:00'));
86413
UPDATE your_table
SET this_time=(EXTRACT(EPOCH FROM (time_a-time_b)));
本文标题:PostgreSQL得出两个timestamp的秒数差值
本文链接:https://www.haomeiwen.com/subject/crhjottx.html
网友评论