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
обсуждение исходный текст
Ответ на Re: Can't EXTRACT number of months from an INTERVAL  (Michael Glaesemann <grzm@seespotcode.net>)
Список 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 по дате отправления:

Предыдущее
От: Mike Christensen
Дата:
Сообщение: Easy way to convert a database from WIN1252 to UTF8?
Следующее
От: Justin Graf
Дата:
Сообщение: Re: Easy way to convert a database from WIN1252 to UTF8?