Months between two dates function

前端 未结 4 2010
孤城傲影
孤城傲影 2021-01-11 21:00

In oracle i can find out no:of months between using MONTHS_BETWEEN function.

In postgres i am using extract function for this. eg.like

select 
    ex         


        
4条回答
  •  北恋
    北恋 (楼主)
    2021-01-11 21:07

    SELECT date_part ('year', f) * 12
          + date_part ('month', f)
    FROM age (CURRENT_DATE, '2014-12-01') f
    

提交回复
热议问题