PG查询最近24小时

 

         select date_trunc('h',now()) -interval '24 h';

WHERE
                 a.req_time BETWEEN (date_trunc('h',now()) -interval '24 h') AND date_trunc('h',now())

 

参考:

 

PostgreSQL date_trunc() 和timestamp

https://www.cnblogs.com/jixiaoleng4/p/10599442.html

 

 

postgreSQL格式化时间的函数详解

 

posted @ 2021-11-15 17:23  戈博折刀  阅读(446)  评论(0编辑  收藏  举报