On Mon, Sep 5, 2016 at 6:59 PM, Vik Fearing <vik@2ndquadrant.fr> wrote:
> Your timestamp subtraction results in 7305 days. The justify_interval
> function, not knowing anything about where those days came from, will
> use 30 days per month, giving you the result you see.
Part of the story that's not apparent here is that intervals track
months and days
separately but don't track years separately. So the justified interval
internally is actually 243 months, 15 days, and 0 seconds. The "20
years" is just part of the output format.
The reason years aren't tracked separately is that they're always 12
months. So if you want an event in your calendar that occurs every
year on the same date you can add an interval like '12 months' to it
and it'll always add exactly a year and land on the same date
regardless of the number of days in the year.
--
greg