Calculating the difference between timetz values

From: Alexey Klyukin <alexk(at)commandprompt(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Calculating the difference between timetz values
Date: 2009-07-27 14:54:07
Message-ID: 74F9F1F7-2F99-4984-8D3C-BD98511C97B6@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message nha 2009-07-27 15:22:12 Re: Postgres and multiple updates in one statement
Previous Message Jamie Lawrence-Jenner 2009-07-27 14:48:53 Re: Postgres and multiple updates in one statement