Months between two dates function

前端 未结 4 2090
孤城傲影
孤城傲影 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:23

    Unfortunately it seems not, because extract(month ...) returns the number of months modulo 12.

    There is one small simplification you can make; remove the first parameter of age() - the default is age from current_date, so these two are equivalent:

    age(current_date, '2012-12-09')
    age('2012-12-09')
    

提交回复
热议问题