where查询昨天数据
SELECT
*
FROM
sys_device
WHERE age(current_date,to_timestamp(substring(update_time FROM 1 FOR 10),'yyyy-MM-dd')) ='1 days';
where查询今天数据
SELECT
*
FROM
sys_device
WHERE to_char(update_time:: DATE, ' yyyy-MM-DD hh 24: mi :s') = to_char(CURRENT_DATE:: DATE, ' yyyy-MM-DD hh 24: mi :s')
select查询昨天的时间
SELECT to_char((now() - interval '1 day'), 'yyyy-MM-dd') ----结果:2023-06-14
SELECT (now() - interval '1 day') ----结果:2023-06-14 13:47:20.335889+08