Received: from finch-post-12.mail.demon.net (finch-post-12.mail.demon.net [194.217.242.41]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5SF3Ia70172 for ; Thu, 28 Jun 2001 11:03:18 -0400 (EDT) (envelope-from dev@archonet.com) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by finch-post-12.mail.demon.net with esmtp (Exim 2.12 #1) id 15FdK4-000Gtf-0C; Thu, 28 Jun 2001 15:03:13 +0000 Received: from client (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with SMTP id 4211111DD4; Thu, 28 Jun 2001 15:44:42 +0100 (BST) Message-ID: <003501c0ffe0$dc3e4700$1001a8c0@archonet.com> From: "Richard Huxton" To: "Jeff Rhys-Jones" , References: <7a92561a.0106280301.6972d149@posting.google.com> Subject: Re: Using DateDiff with Postgres Date: Thu, 28 Jun 2001 15:44:38 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Archive-Number: 200106/450 X-Sequence-Number: 3753 From: "Jeff Rhys-Jones" > Hi there. I was wondering if anyone can tell me the correct syntax for > using DateDiff for postgrees. I'm using MI (or mi) for minute and I > keep getting attribute 'mi' not found. > > I've looked at postgres.org and can't seem to find any ref. to using > datediff. You just subtract dates with PG: select now() - CURRENT_DATE; Will return an "interval" type with the elapsed time since midnight. If you want that in seconds do: select extract(epoch from (now() - CURRENT_DATE)); Converting to minutes is obviously easy from there. I think datediff() is a MS-Access thing isn't it? - Richard Huxton