Re: timespan casting - Mailing list pgsql-sql

From Ed Loehr
Subject Re: timespan casting
Date
Msg-id 3952C394.67050AC5@austin.rr.com
Whole thread Raw
In response to timespan casting  (Jeff MacDonald <jeff@pgsql.com>)
List pgsql-sql
Jeff MacDonald wrote:
> 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
> 
> now my question.. first of all is the first start_stop result a little
> off ? (talking about the 3 0's..)

What's off about it??  Your start and stop appear identical.

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

Try to_char().  http://www.postgresql.org/docs/postgres/x2976.htm

Regards,
Ed Loehr


pgsql-sql by date:

Previous
From: Ryan Kirkpatrick
Date:
Subject: Re: [GENERAL] Sequences do not obey transactions...
Next
From: darcy@druid.net (D'Arcy J.M. Cain)
Date:
Subject: Re: Using substr with user defined types