From: | Theodore Petrosky <tedpet5(at)yahoo(dot)com> |
---|---|
To: | Bruno Wolff III <bruno(at)wolff(dot)to> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: to_char(interval) ? |
Date: | 2005-04-25 11:48:33 |
Message-ID: | 20050425114833.89927.qmail@web41010.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)wolff(dot)to> wrote:
> On Sun, Apr 24, 2005 at 13:08:04 -0700,
> Theodore Petrosky <tedpet5(at)yahoo(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tony Wasson | 2005-04-25 15:51:40 | Re: Looking for a way to sum integer arrays.... |
Previous Message | Ramakrishnan Muralidharan | 2005-04-25 09:29:08 | Re: Looking for a way to sum integer arrays.... |