Skip site navigation (1) Skip section navigation (2)

timespan casting

From: Jeff MacDonald <jeff(at)pgsql(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: timespan casting
Date: 2000-06-22 23:46:30
Message-ID: Pine.BSF.4.21.0006222030390.280-100000@rage.hub.org (view raw or flat)
Thread:
Lists: pgsql-sql
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




Responses

pgsql-sql by date

Next:From: Ryan KirkpatrickDate: 2000-06-23 00:36:34
Subject: Re: Sequences do not obey transactions...
Previous:From: Dorin GrunbergDate: 2000-06-22 21:27:35
Subject: Re: Wildcard in date field???

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group