pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff MacDonald <jeff@pgsql.com>
To: pgsql-sql@postgresql.org
Subject: timespan casting
Date: Thu, 22 Jun 2000 20:46:30 -0300 (ADT)
Message-ID: <Pine.BSF.4.21.0006222030390.280-100000@rage.hub.org> (raw)

hi,

thought this up while playing with time spans..

here is my table and data..

bignose=> \d foo
           Table "foo"
 Attribute |   Type    | Modifier 
-----------+-----------+----------
 start     | timestamp | 
 stop      | timestamp | 

bignose=> select start,stop, stop-start as start_stop from foo;
         start          |          stop          | start_stop 
------------------------+------------------------+------------
 2000-06-22 20:37:12-03 | 2000-06-22 20:37:12-03 | 00:000
 2000-06-22 20:40:40-03 | 2000-06-23 20:40:40-03 | 1 00:00
 2000-06-22 20:40:53-03 | 2000-09-30 20:40:53-03 | 100 00:00
 2000-06-22 20:41:08-03 | 2000-06-23 02:41:08-03 | 06:00
 2000-06-22 20:41:30-03 | 2010-11-22 19:41:30-04 | 3805 00:00
(5 rows)

now my question.. first of all is the first start_stop result a little
off ? (talking about the 3 0's..)

second is there a way i can do a select so it says something more human
usable ie : 100 days 22 hours 32 minutes..

jeff






view thread (2+ messages)  latest in thread

Message-ID: <Pine.BSF.4.21.0006222030390.280-100000@rage.hub.org>
Permalink:  ../Pine.BSF.4.21.0006222030390.280-100000@rage.hub.org/
Also on:    postgresql.org/message-id/Pine.BSF.4.21.0006222030390.280-100000@rage.hub.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: jeff@pgsql.com
  Subject: Re: timespan casting
  In-Reply-To: <Pine.BSF.4.21.0006222030390.280-100000@rage.hub.org>
  References: <Pine.BSF.4.21.0006222030390.280-100000@rage.hub.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