Re: Convert time to millisec?

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Convert time to millisec?
Дата
Msg-id 20060828132002.GA4250@winnie.fuhr.org
обсуждение исходный текст
Ответ на Convert time to millisec?  (Bjørn T Johansen <btj@havleik.no>)
Ответы Re: Convert time to millisec?
Список pgsql-general
On Mon, Aug 28, 2006 at 10:48:47AM +0200, Bjørn T Johansen wrote:
> select sum(Til - Fra) as total from Log_stop where OrdreID = 3434
>
> but I would like the result to be in milliseconds, is this possible? If so, how?
> (the fields Til and Fra is of type Time)

You could use extract(epoch from <interval>) to get the number of
seconds (with fractional part) in an interval, then multiply by
1000 to get milliseconds.  Example:

select extract(epoch from sum(Til - Fra)) * 1000.0 ...

--
Michael Fuhr

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

Предыдущее
От: Rafal Pietrak
Дата:
Сообщение: Re: optimising UNION performance
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Shared Objects (Dynamic loading)