Number of months

From: Patrick Hatcher <PHatcher(at)macys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Number of months
Date: 2004-11-03 18:52:18
Message-ID: OFF980F669.F075E431-ON88256F41.0063B840-88256F41.0068E77D@fds.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is there a function that will give me the number of months, as an
integer, in Pg 7.4.x? I found the date_trunc function but that will
return text and I didn't see anything else?

I have this, but didn't want to duplicate the work if it wasn't necessary:

(date_part('Year', CURRENT_DATE) -date_part('Year', SOMEDATE)) * 12
+date_part('Month', CURRENT_DATE)-date_part('Month',SOMEDATE)

TIA

Patrick Hatcher

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Reynard Hilman 2004-11-03 18:59:54 pg_xlog
Previous Message Joe Conway 2004-11-03 18:33:32 Re: MD5 for PostgreSQL 7.3.4