pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris <dmagick@gmail.com>
To: pgsql-sql@postgresql.org
Subject: getting extract to always return number of hours
Date: Wed, 06 Jan 2010 12:33:59 +1100
Message-ID: <4B43E887.6040402@gmail.com> (raw)

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/




view thread (3+ messages)  latest in thread

Message-ID: <4B43E887.6040402@gmail.com>
Permalink:  ../4B43E887.6040402@gmail.com/
Also on:    postgresql.org/message-id/4B43E887.6040402@gmail.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dmagick@gmail.com
  Subject: Re: getting extract to always return number of hours
  In-Reply-To: <4B43E887.6040402@gmail.com>

* 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