Get interval in months

From: Gerhard Heift <ml-postgresql-20081012-3518(at)gheift(dot)de>
To: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Get interval in months
Date: 2008-11-08 09:12:45
Message-ID: 20081108091245.GA6411@toaster.kawo1.rwth-aachen.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I want to get an interval in months from two dates:

SELECT '2008-02-01'::timestamp - '2008-01-01'::timestamp AS '1 month'

Here I want '1 month' and not '31 days' as answer.

How can I do this?

Regards,
Gerhard

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Asko Oja 2008-11-08 09:36:06 Re: options for launching sql script asynchronously from web app
Previous Message Andreas Kraftl 2008-11-08 08:44:17 Fulltext index