时间差天数
select '2017-12-10'::date - '2017-12-01'::date;
时间差秒数
select extract(epoch FROM (now() - (now()-interval '1 day') )); select trunc(extract(epoch FROM (now() - (now()-interval '1 day') ))::numeric); select trunc(extract(epoch FROM (now() - (now()-interval '1 day') ))::numeric,1); select round(extract(epoch FROM (now() - (now()-interval '1 day') ))::numeric); select round(extract(epoch FROM (now() - (now()-interval '1 day') ))::numeric,1);