Re: Converting time interval to double precision of time unit

Поиск
Список
Период
Сортировка
От Mike Toews
Тема Re: Converting time interval to double precision of time unit
Дата
Msg-id 22f0a52d1003301236y189f0ba2y46091f657eec4cb1@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Converting time interval to double precision of time unit  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On 30 March 2010 11:55, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I think what Mike is actually looking for is
>
> SELECT extract(epoch from interval '3 days 2 hours 34 minutes');
>  date_part
> -----------
>    268440

Yet better, if I define 1 hour as 3600 seconds (this is only incorrect
if the interval spans over a leap second), then the fractional hours
are:

SELECT extract(epoch from interval '3 days 2 hours 34 minutes')/3600 as hours;

Thanks!

-Mike

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Converting time interval to double precision of time unit
Следующее
От: John Gage
Дата:
Сообщение: Running Windows on a Mac partition