Received: from office.knowledge.com (IDENT:exim@office.knowledge.com [195.40.167.196]) by hub.org (8.9.3/8.9.1) with ESMTP id EAA05158 for ; Fri, 30 Apr 1999 04:10:11 -0400 (EDT) (envelope-from mark@knowledge.com) Received: from mark (helo=localhost) by office.knowledge.com with local-esmtp (Exim 2.10 #1) id 10d8My-0005BC-00; Fri, 30 Apr 1999 09:10:00 +0100 Date: Fri, 30 Apr 1999 09:10:00 +0100 (BST) From: Mark Jewiss To: JT Kirkpatrick cc: "'pgsql-sql@hub.org'" Subject: Re: [SQL] time intervals In-Reply-To: <01BE925B.352BE160.jt-kirkpatrick@mpsllc.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: Mark Jewiss > 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. In SQL you can do a DATEDIFF...I'm not in front of postgresql so am not sure if it supports this. Syntax is select datediff (day, mydate, 'Jan 10 1999' from table If mydate = Jan 9, then the result is one. I think datediff accepts datetime, so if you specify it properly (i.e. '1 Jan 1999 10:05") then you'll get the right answers. Just change day to whatever you need. Regards, Mark. -- Mark Jewiss Knowledge Matters Limited