Received: from mail1.panix.com (mail1.panix.com [166.84.0.212]) by hub.org (8.9.3/8.9.3) with ESMTP id LAA98267 for ; Fri, 30 Jul 1999 11:55:47 -0400 (EDT) (envelope-from tomg@admin.nrnet.org) Received: from mailhost.nrnet.org (mailhost.nrnet.org [166.84.192.39]) by mail1.panix.com (Postfix) with ESMTP id 06B8892D; Fri, 30 Jul 1999 11:55:33 -0400 (EDT) Received: from admin.nrnet.org (uucp@localhost) by mailhost.nrnet.org (8.8.7/8.8.4) with UUCP id KAA13719; Fri, 30 Jul 1999 10:13:36 -0400 Received: from localhost (tomg@localhost) by admin.nrnet.org (8.8.7/8.8.7) with SMTP id KAA04192; Fri, 30 Jul 1999 10:15:32 -0400 Date: Fri, 30 Jul 1999 10:15:32 -0400 (EDT) From: Thomas Good To: "PostgreSQL::SQL List" Cc: Herouth Maoz Subject: date_arithmetic revisited Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Herouth, I am doing this: psql tracker -qtc "select date_part('epoch', '$edate'::datetime);" > .arg1 psql tracker -qtc "select date_part('epoch', '$sdate'::datetime);" > .arg2 date1=`cat .arg1`; date2=`cat .arg2`; psql tracker -qtc "select ($date1 - $date2) / 60 / 60 / 24;" to calculate intervals...this is census stuff. How many Pt Days per bed, etc. Is there a way/function that allows me to do simple date arithmetic, ala, `SELECT $enddate - startdate;' ? Cheers and thanks, Tom ------- North Richmond Community Mental Health Center ------- Thomas Good MIS Coordinator Vital Signs: tomg@ { admin | q8 } .nrnet.org Phone: 718-354-5528 Fax: 718-354-5056 /* Member: Computer Professionals For Social Responsibility */