Karsten Hilbert <Karsten.Hilbert@gmx.net> writes:
> I am now looking for a way to say:
> select age('1999-2-2', '1999-3-2', without months);
> select age('1999-5-2', '1999-6-2', without months);
> and get "28 days" in the first and "31 days" in the second
> result.
Just subtract the two timestamps (or dates) instead of using age().
Then you get an interval that has no month component.
> However, if you say that "1 mon" is always considered 30 days
He didn't say that. He said that when the system *must* convert a
month-based interval to days and it has no date reference for it,
it uses 30 days. Something like "now() + '1 month'::interval"
will do the "right thing". This IMHO is the main application of
intervals with month components ...
regards, tom lane