Re: BUG #1107: Missing feature: interval <-> numeric quantity conversion
В списке pgsql-bugs по дате отправления:
| От | Francisco Olarte Sanz |
|---|---|
| Тема | Re: BUG #1107: Missing feature: interval <-> numeric quantity conversion |
| Дата | |
| Msg-id | 200403181802.47159.folarte@peoplecall.com обсуждение исходный текст |
| Ответ на | BUG #1107: Missing feature: interval <-> numeric quantity conversion ("PostgreSQL Bugs List" <pgsql-bugs@postgresql.org>) |
| Список | pgsql-bugs |
Hi:
....
> Having two timestamps it is common need to know how many
> seconds/minutes/hours/days/etc. passed from one to the other. However there
> is no easy way to do this task.
> The basic idea is subtracting the two timestamps. However it gives a data
> type called "interval". The thing I would like to have is a function that
> takes the "interval" and outputs it's length. Currently when I want a
> program to know how long an interval is I must let it parse the interval
> textual representation (which may be subject to change) to obtain what I
> want.
I do this a lot, just try 'extract(epoch from the_interval)' ( actually in my
code i use things like 'extract(epoch from age(disconnect_time,
connect_time))' where *_time are of type 'timestamp with time zone' and works
like a charm, even across time zone changes.
Francisco Olarte..
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера