Calculating the difference between timetz values - Mailing list pgsql-general

From Alexey Klyukin
Subject Calculating the difference between timetz values
Date
Msg-id 74F9F1F7-2F99-4984-8D3C-BD98511C97B6@commandprompt.com
Whole thread Raw
Responses Re: Calculating the difference between timetz values
List pgsql-general
Hello,

I was looking for a way to get the difference (interval) between 2
timetz values, i.e.:

postgres=# select '2:45+7'::timetz - '2:44+2'::timetz;
ERROR:  operator does not exist: time with time zone - time with time
zone
LINE 1: select '2:45+7'::timetz - '2:44+2'::timetz;

I'd expect the result of the above to be the interval of 05:01:00. Is
there any function or operator that calculates the difference
correctly ? I've found a way to cast a timetz to the time without TZ
and substract resulting time values, but it's not a correct solution
for the problem above due to the loss of all TZ information.

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


pgsql-general by date:

Previous
From: "Jamie Lawrence-Jenner"
Date:
Subject: Re: Postgres and multiple updates in one statement
Next
From: nha
Date:
Subject: Re: Postgres and multiple updates in one statement