Re: to_char(interval) ?

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: to_char(interval) ?
Дата
Msg-id 20050425042327.GA2882@wolff.to
обсуждение исходный текст
Ответ на to_char(interval) ?  (Theodore Petrosky <tedpet5@yahoo.com>)
Список pgsql-sql
On Sun, Apr 24, 2005 at 13:08:04 -0700, Theodore Petrosky <tedpet5@yahoo.com> wrote:
> how do I get an interval '1 day 1 hour' to display as
> '25 hours'. I am hunting in the docs (and googling)
> and either I am blind or I need a special function?
> 
> Is there an easy way?

EXTRACT epoch from the interval and divide by 3600 and concatenate to ' hours'.

area=> select extract(epoch from '1 day 1 hour'::interval)/3600 || ' hours';?column?
----------25 hours
(1 row)


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

Предыдущее
От: John DeSoi
Дата:
Сообщение: Re: php wrapper
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Matching the MYSQL "Describe " command