Re: More straight forward method to convert seconds::bigint to interval
В списке pgsql-general по дате отправления:
| От | Adam Rich |
|---|---|
| Тема | Re: More straight forward method to convert seconds::bigint to interval |
| Дата | |
| Msg-id | 4ABA89AB.1080800@sbcglobal.net обсуждение исходный текст |
| Ответ на | More straight forward method to convert seconds::bigint to interval ("Shane R. Spencer" <shane@bogomip.com>) |
| Ответы |
Re: More straight forward method to convert seconds::bigint
to interval
|
| Список | pgsql-general |
Shane R. Spencer wrote:
> I work in VoIP. HMS (Hour/Minute/Second) format appears to be the rule
> when working with call time totals. I admit it makes some reports
> easier to read.
>
> The method I used to convert a int/bigint to HMS (or the standard
> representation of an interval type) is as follows:
>
> select (123456.789::varchar(24) || ' seconds')::interval as HMS;
> hms
> --------------
> 34:17:36.789
>
> Is there a less string oriented method of converting seconds as an int
> to an interval?
>
> - Shane
>
I think this is cleaner/faster:
select interval '1 second' * 123456.789 as HMS;
hms
--------------
34:17:36.789
-Adam
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера