Re: Calculating the difference between timetz values

Поиск
Список
Период
Сортировка
Искать
От
Alexey Klyukin
Тема
Re: Calculating the difference between timetz values
Дата
Msg-id
24C7B5EB-3A03-4005-9C05-2573CB77335D@commandprompt.com
Ответ на
Список
Дерево обсуждения
Calculating the difference between timetz values Alexey Klyukin <alexk@commandprompt.com>
Re: Calculating the difference between timetz values Michael Glaesemann <grzm@seespotcode.net>
Re: Calculating the difference between timetz values Alexey Klyukin <alexk@commandprompt.com>
Re: Calculating the difference between timetz values Tom Lane <tgl@sss.pgh.pa.us>
Re: Calculating the difference between timetz values Alvaro Herrera <alvherre@commandprompt.com>

On Jul 27, 2009, at 6:52 PM, Michael Glaesemann wrote:

>
> On Jul 27, 2009, at 10:54 , Alexey Klyukin wrote:
>
>> Hello,
>>
>> I was looking for a way to get the difference (interval) between 2  
>> timetz values, i.e.:
>
> I don't have a solution, but am curious what your use case is for  
> timetz (as opposed to timestamptz).

I'm writing a custom trigger function that has to compare values of  
time* types and make some actions depending on a result.

Answering my own question, Alvaro proposed a solution with  
extract(epoch from tz_value), the result is in seconds:

postgres=# select extract(epoch from '00:00:00+0'::timetz) -  
extract(epoch from '2:00:00+2'::timetz);
  ?column?
----------
         0
(1 row)

--
Alexey Klyukin       http://www.CommandPrompt.com
The PostgreSQL Company - Command Prompt, Inc.

В списке pgsql-general по дате отправления
От: John R Pierce
Дата:
Сообщение: Re: Run procedure at startup
От: Bob Gobeille
Дата:
FAQ