why justify_interval('360 days'::interval) results '1 year'

后端 未结 2 1578
南笙
南笙 2021-01-17 01:36

For some reason justify_interval(now() - \'2013-02-14\'::timestamptz) produces weird results:

postgres=# select justify_interval(concat(365*4 +1         


        
2条回答
  •  轮回少年
    2021-01-17 01:58

    accrding to docs:

    justify_interval(interval) - Adjust interval using justify_days and justify_hours, with additional sign adjustments

    and further:

    justify_days(interval) - Adjust interval so 30-day time periods are represented as months

    So 30*12=360

    Not expected but obviously defined in docs...

提交回复
热议问题