人大金仓数据库 生成时间列表

 

 

SELECT to_char(generate_series('2024-12-01'::DATE, '2024-12-31'::DATE , '2 day'),'YYYY-MM-DD') AS date;
                    
 SELECT to_char(generate_series('2024-12-12 00'::DATETIME , '2024-12-12 15'::DATETIME - '1 hour'::interval, '1 hour'),'YYYY-MM-DD HH24') AS date;
              
SELECT to_char(generate_series('2024-12-01'::DATE, '2025-01-01'::DATE - '1 day'::interval, '1 day'),'YYYY-MM-DD') AS date;
              
 SELECT to_char(generate_series('2024-12-01'::DATE, '2024-12-22'::DATE - '1 week'::interval, '1 week'),'YYYY-MM-DD') AS date;
              
SELECT to_char(generate_series('2024-12-12 00:00:00'::DATETIME , '2024-12-13 00:00:00'::DATETIME - '1 hour'::interval, '1 hour'),'YYYY-MM-DD HH24') AS date;
    


    select to_char(generate_series('2024-06-12 00:00:00'::DATETIME , '2024-12-13 00:00:00'::DATETIME, '1 month'),'YYYY-MM') as 'statisticTime' 
    select to_char(generate_series(1 , 14, 1)) as 'statisticTime' 
    select to_char(generate_series('2024-12-01 00:00:00'::DATETIME , '2024-12-12 23:59:59'::DATETIME, '1 day'),'YYYY-MM-DD') as 'statisticTime' 
    select to_char(generate_series('2024-12-12 00:00:00'::DATETIME , '2024-12-12 23:59:59'::DATETIME, '1 hour'),'YYYY-MM-DD HH24') as 'statisticTime' 

  

posted @ 2023-12-12 21:26  ジ绯色月下ぎ  阅读(281)  评论(0编辑  收藏  举报