pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Good <tomg@admin.nrnet.org>
To: PostgreSQL::SQL List <pgsql-sql@postgreSQL.org>
Cc: Herouth Maoz <herouth@oumail.openu.ac.il>
Subject: date_arithmetic revisited
Date: Fri, 30 Jul 1999 10:15:32 -0400 (EDT)
Message-ID: <Pine.LNX.3.96.990730101114.4153A-100000@admin.nrnet.org> (raw)


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




view thread (3+ messages)  latest in thread

Message-ID: <Pine.LNX.3.96.990730101114.4153A-100000@admin.nrnet.org>
Permalink:  ../Pine.LNX.3.96.990730101114.4153A-100000@admin.nrnet.org/
Also on:    postgresql.org/message-id/Pine.LNX.3.96.990730101114.4153A-100000@admin.nrnet.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: tomg@admin.nrnet.org, herouth@oumail.openu.ac.il
  Subject: Re: date_arithmetic revisited
  In-Reply-To: <Pine.LNX.3.96.990730101114.4153A-100000@admin.nrnet.org>
  References: <Pine.LNX.3.96.990730101114.4153A-100000@admin.nrnet.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox