赞
踩
使用date_part函数
-- create_time 2022-06-09 17:06:20 now() 2022-06-08 09:03:00
select date_part('day',cast(su.create_time as TIMESTAMP)-cast(now() as TIMESTAMP)) from face_data as su where id=300124
select CURRENT_DATE::date - '2022-06-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);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。