From: Bruno Wolff III <bruno@wolff.to>
To: Theodore Petrosky <tedpet5@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: to_char(interval) ?
Date: Sun, 24 Apr 2005 23:23:27 -0500
Message-ID: <20050425042327.GA2882@wolff.to> (raw)
In-Reply-To: <20050424200805.49157.qmail@web41010.mail.yahoo.com>
References: <20050424200805.49157.qmail@web41010.mail.yahoo.com>
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)
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: bruno@wolff.to, tedpet5@yahoo.com
Subject: Re: to_char(interval) ?
In-Reply-To: <20050425042327.GA2882@wolff.to>
* 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