Thanks!  justify_interval is what I needed, I had never heard of it.  I was 
already prepared to deal with getting the years and 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    


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to