Postgre Sql获取最近一周、一月、一年日期函数

  使用Postgre Sql获取近一周、一年、一月等系统函数调用如下,使用方面相对于Ms Sql server 容易了许多。

--当前时间
select now();
--current_timestamp 同 now() 函数等效
select current_timestamp 
 
--近一周
  select now() - interval '1 week';

--近一月
 select now() - interval '1 month';

--近一年
 select now() - interval '1 year';

--下一周
  select now() + interval '1 week';

--下一月
 select now() + interval '1 month';

--下一年
 select now() + interval '1 year';

 

posted @ 2019-04-29 16:01  低调码农哥!  阅读(9014)  评论(0编辑  收藏  举报