JT Kirkpatrick wrote:
I have two fields, timein & timeout, both defined as type "time".  how can
i get the difference between the two??  i am connecting to postgres through
access97 and trying to run a simple query to show me timeout, timein, and
timeout-timein, but the calculation is returning an error.

thanks in advance!  jt


If your field is defined by tipe "time", the date is not important.

In this case you can use the age(datetime, datetime) in this mode:

a. timein < timeout:

test=> select age(datetime('today'::date,'10:00:15'::time), datetime('today'::date,'12:25:24'::time));
age
----------------------------
@ 2 hours 25 mins 9 secs ago
(1 row)

or

b. timein > timeout:
test=> select age(datetime('today'::date,'10:00:15'::time), datetime('today'::date,'2:25:24'::time));
age
-------------------------
@ 7 hours 34 mins 51 secs
(1 row)
 

I use PostgreSQL v6.5.0 (09-04-1999) on Red Hat LINUX 5.2 with 2.2.5 kernel.
-- 
Best,
  George Moga,
  george@flex.ro
  Braila,ROMANIA