Re: Time difference without intervals

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Time difference without intervals
Дата
Msg-id 20021108185910.GA7364@wolff.to
обсуждение исходный текст
Ответ на Time difference without intervals  (Roberto Mello <rmello@cc.usu.edu>)
Список pgsql-sql
On Fri, Nov 08, 2002 at 11:20:02 -0700, Roberto Mello <rmello@cc.usu.edu> wrote:
> 
> Is there any way to make a timestamp difference operation not return an
> interval? I'd like to get hours, minutes and seconds only, not the "1 day"
> or whatnot.

When you take a difference of two timestamps, you are going to get an
interval that does not have a year, month difference component.

You can get the interval value in seconds by using
extract(epoch from interval).

You can then further manipulate this value to get hours, minutes and seconds.


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

Предыдущее
От: Roberto Mello
Дата:
Сообщение: Time difference without intervals
Следующее
От: Robert Treat
Дата:
Сообщение: Re: changing numeric into int