getting extract to always return number of hours

From: Chris <dmagick(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: getting extract to always return number of hours
Date: 2010-01-06 01:33:59
Message-ID: 4B43E887.6040402@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

I'm trying to get extract() to always return the number of hours between
two time intervals, ala:

=> create table t1(timestart timestamp, timeend timestamp);
=> insert into t1(timestart, timeend) values ('2010-01-01 00:00:00',
'2010-01-02 01:00:00');

=> select timeend - timestart from t1;
?column?
----------------
1 day 01:00:00
(1 row)

to return 25 hours.

I couldn't see anything in the docs and can't work out a way to do it.

Any suggestions?

Thanks!
--
Postgresql & php tutorials
http://www.designmagick.com/

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rosser Schwarz 2010-01-06 01:50:13 Re: getting extract to always return number of hours
Previous Message Jasen Betts 2010-01-01 10:39:23 Re: Proper case function