date_arithmetic revisited

From: Thomas Good <tomg(at)admin(dot)nrnet(dot)org>
To: "PostgreSQL::SQL List" <pgsql-sql(at)postgreSQL(dot)org>
Cc: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
Subject: date_arithmetic revisited
Date: 1999-07-30 14:15:32
Message-ID: Pine.LNX.3.96.990730101114.4153A-100000@admin.nrnet.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


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 */

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Carlos 1999-07-30 14:50:55 unsuscribe
Previous Message Darrin Crook 1999-07-30 13:32:38 Re: [SQL] Error when inserting