Regarding interval conversion functions and a seeming lack of usefulness

Поиск
Список
Период
Сортировка
От Bill Moran
Тема Regarding interval conversion functions and a seeming lack of usefulness
Дата
Msg-id 20080227094749.f69e36be.wmoran@collaborativefusion.com
обсуждение исходный текст
Ответы Re: Regarding interval conversion functions and a seeming lack of usefulness
Re: Regarding interval conversion functions and a seeming lack of usefulness
Список pgsql-general
This has come up a few times over the last few months, and I'm not
too keen on the solutions we've been using.

There seems to be a lack of useful functions for converting intervals
to useful representations.  For example, I want to display an interval
in hours and fractions of hours only, not hours and minutes.  There
are lots of examples of when certain representations are more appropriate
than others (think pregnancy terms, why on earth is the woman never
pregnant for 3 months?  It's always 12 weeks!)

Anyway, rant aside, I can't seem to find anything to do this in PG.
I could write a stored procedure easily enough, but I want to make
sure I'm not reinventing the wheel first (I find it hard to believe
I'm the first person ever wanting to do this!)

Something like:
$ SELECT CONVERT('12 days 13 hours'::INTERVAL AS hour);
 hour
------
   301
$ SELECT CONVERT('6 hours 17 minutes'::INTERVAL AS hour);
 hour
------
6.2833

Am I approaching this problem wrong? or is there something out there
and my Google skills are lacking?

--
Bill Moran
Collaborative Fusion Inc.
http://people.collaborativefusion.com/~wmoran/

wmoran@collaborativefusion.com
Phone: 412-422-3463x4023

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

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: PostgreSQL-installation-problem on Windows XP Home edition
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: PostgreSQL-installation-problem on Windows XP Home edition