Re: Converting interval to numeric?

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Converting interval to numeric?
Дата
Msg-id 20050211045825.GA9313@wolff.to
обсуждение исходный текст
Ответ на Converting interval to numeric?  ("Sal Dkj" <saldkj@hotmail.com>)
Ответы Re: Converting interval to numeric?  ("Rodolfo J. Paiz" <rpaiz@simpaticus.com>)
Re: Converting interval to numeric?  ("Sal Dkj" <saldkj@hotmail.com>)
Список pgsql-novice
On Fri, Feb 11, 2005 at 01:48:06 +0000,
  Sal Dkj <saldkj@hotmail.com> wrote:
> Hello, I'm trying to calculate the difference between two timestamps and
> have the return value in minutes.
>
> So, for instance:
> Time 1 = 1/1/2005 12:00
> Time 2 = 1/2/2005 12:00
>
> If you subtract Time 1 from Time 2, it returns an interval value of '1
> day'. Extracting hours or minutes from this obviously gives 0.  What's the
>  trick here?

EXTRACT the EPOCH from the difference of the timestamps. This will give
you the elapsed times in seconds (as a float8 I think).

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Mike G."
Дата:
Сообщение: Re: PL/pgSQL: FOT Loops vs Cursors
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: function returning a row