postgreSQL 获取两个时间点内每个月第一天的日期。

[sql]  view plain copy print ? 在CODE上查看代码片 派生到我的代码片
 
  1. select  date(zz) from   
  2. generate_series(date_trunc('month',to_date('20150305','yyyymmdd')),  
  3. date_trunc('month',to_date('20150705','yyyymmdd')),'1 month') as tt(zz);  

 

结果为:

postgreSQL 获取两个时间点内每个月第一天的日期。

你可能感兴趣的:(PostgreSQL)