From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Terry Lee Tucker <terry(at)esc1(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Interval Question |
Date: | 2005-01-11 15:19:01 |
Message-ID: | 16557.1105456741@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Terry Lee Tucker <terry(at)esc1(dot)com> writes:
> I thought that subtracting the larger interval from
> the small would return this but it is always the absolute value.
Eh?
regression=# set DateStyle TO ISO;
SET
regression=# select '@ 3 days 4 hours 17 mins'::interval -
regression-# '@ 3 days 6 hours 17 mins'::interval;
?column?
-----------
-02:00:00
(1 row)
regression=# set DateStyle TO postgres;
SET
regression=# select '@ 3 days 4 hours 17 mins'::interval -
regression-# '@ 3 days 6 hours 17 mins'::interval;
?column?
---------------
@ 2 hours ago
(1 row)
and as for detecting whether it's negative,
regression=# select ('@ 3 days 4 hours 17 mins'::interval -
regression(# '@ 3 days 6 hours 17 mins'::interval) < '0'::interval;
?column?
----------
t
(1 row)
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Terry Lee Tucker | 2005-01-11 15:35:37 | Re: Interval Question |
Previous Message | Stephan Szabo | 2005-01-11 15:18:03 | Re: Interval Question |