Re: Can't EXTRACT number of months from an INTERVAL

Поиск
Список
Период
Сортировка
Искать
От
Eliot, Christopher
Тема
Re: Can't EXTRACT number of months from an INTERVAL
Дата
Msg-id
EDF9B887785F8A47B7F96D70AD69D91001147F181E@nstar-server7
Ответ на
Список
Дерево обсуждения
Can't EXTRACT number of months from an INTERVAL "Eliot, Christopher" <christopher.eliot@nagrastar.com>
Re: Can't EXTRACT number of months from an INTERVAL Michael Glaesemann <grzm@seespotcode.net>
Re: Can't EXTRACT number of months from an INTERVAL "Eliot, Christopher" <christopher.eliot@nagrastar.com>
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    

В списке pgsql-general по дате отправления
От: Mike Christensen
Дата:
От: Justin Graf
Дата:
FAQ