pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Theodore Petrosky <tedpet5@yahoo.com>
To: Bruno Wolff III <bruno@wolff.to>
Cc: pgsql-sql@postgresql.org
Subject: Re: to_char(interval) ?
Date: Mon, 25 Apr 2005 04:48:33 -0700 (PDT)
Message-ID: <20050425114833.89927.qmail@web41010.mail.yahoo.com> (raw)

This is perfect.

select extract(epoch from '1 day 1 hour 15
minute'::interval)/3600 || 'hours';
  ?column?  
------------
 25.25hours
(1 row)

I must have looked at this for hours and not seen the
'interval' part of the epoch...

Thanks,

Ted

--- Bruno Wolff III <bruno@wolff.to> wrote:
> On Sun, Apr 24, 2005 at 13:08:04 -0700,
>   Theodore Petrosky <tedpet5@yahoo.com> wrote:
> > how do I get an interval '1 day 1 hour' to display
> as
> > '25 hours'. I am hunting in the docs (and
> googling)
> > and either I am blind or I need a special
> function?
> > 
> > Is there an easy way?
> 
> EXTRACT epoch from the interval and divide by 3600
> and concatenate to ' hours'.
> 
> area=> select extract(epoch from '1 day 1
> hour'::interval)/3600 || ' hours';
>  ?column?
> ----------
>  25 hours
> (1 row)
> 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



view thread (3+ messages)

Message-ID: <20050425114833.89927.qmail@web41010.mail.yahoo.com>
Permalink:  ../20050425114833.89927.qmail@web41010.mail.yahoo.com/
Also on:    postgresql.org/message-id/20050425114833.89927.qmail@web41010.mail.yahoo.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: tedpet5@yahoo.com, bruno@wolff.to
  Subject: Re: to_char(interval) ?
  In-Reply-To: <20050425114833.89927.qmail@web41010.mail.yahoo.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