Re: Can't EXTRACT number of months from an INTERVAL - Mailing list pgsql-general

From Eliot, Christopher
Subject Re: Can't EXTRACT number of months from an INTERVAL
Date
Msg-id EDF9B887785F8A47B7F96D70AD69D91001147F181E@nstar-server7
Whole thread Raw
In response to Re: Can't EXTRACT number of months from an INTERVAL  (Michael Glaesemann <grzm@seespotcode.net>)
List pgsql-general
Thanks!  justify_interval is what I needed, I had never heard of it.  I was already prepared to deal with getting the
yearsand multiplying by 12. 

Topher
[]

On Jun 30, 2010, at 18:45 , Eliot, Christopher wrote:

> I need to read a timestamp from the database and turn that into an integer describing how many months ago the event
happened,rounding downward.  The events are guaranteed to be in the past. 

=# select timestamp '2010-06-26 00:00:00' - timestamp  '2008-11-07 00:00:00';
 ?column?
----------
 596 days
(1 row)

=# select justify_interval(timestamp '2010-06-26 00:00:00' - timestamp  '2008-11-07 00:00:00');
   justify_interval


pgsql-general by date:

Previous
From: Mike Christensen
Date:
Subject: Easy way to convert a database from WIN1252 to UTF8?
Next
From: Justin Graf
Date:
Subject: Re: Easy way to convert a database from WIN1252 to UTF8?