使用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';