## Re: Problem in age on a dates interval

From: Tom Lane Theodore Petrosky Luis Sousa , pgsql-sql(at)postgresql(dot)org Re: Problem in age on a dates interval 2004-07-16 14:34:07 20678.1089988447@sss.pgh.pa.us (view raw or whole thread) 2004-07-16 08:45:24 from Luis Sousa  2004-07-16 11:52:14 from Theodore Petrosky   2004-07-16 14:34:07 from Tom Lane    2004-07-19 09:00:50 from Luis Sousa     2004-07-19 10:46:46 from "Alexander M(dot) Pravking"      2004-07-20 08:17:15 from Luis Sousa pgsql-sql
```Theodore Petrosky <tedpet5(at)yahoo(dot)com> writes:
> wow.... at first I thought I had my head around a leap

I think what's going on here is a difference of interpretation about
whether an "M months D days" interval means to add the months first
or the days first.  For instance

2005-02-18 plus 2 months = 2005-04-18, plus 24 days = 2005-05-12

2005-02-18 plus 24 days = 2005-03-14, plus 2 months = 2005-05-14

The timestamp-plus-interval operator is evidently doing addition the
first way, but it looks like age() is calculating the difference in a
way that implicitly corresponds to the second way.

I have some vague recollection that this has come up before, but
I don't recall whether we concluded that age() needs to be changed
or not.  In any case it's not risen to the top of anyone's to-do list,
because I see that age() still acts this way in CVS tip.

regards, tom lane

```

### pgsql-sql by date

 Next: From: Stephan Szabo Date: 2004-07-16 19:14:38 Subject: Re: Sorting problem Previous: From: Theodore Petrosky Date: 2004-07-16 11:52:14 Subject: Re: Problem in age on a dates interval