From: Tim Landscheidt <tim@tim-landscheidt.de>
To: pgsql-sql@postgresql.org
Subject: Re: time interval math
Date: Thu, 09 Feb 2012 01:51:10 +0000
Message-ID: <m3d39oixkh.fsf@passepartout.tim-landscheidt.de> (raw)
References: <032001cce69c$767bc010$63734030$@com>
<4F32DA3B.9080209@pinpointresearch.com>
<032701cce6a3$28c8fca0$7a5af5e0$@com>
"Edward W. Rouse" <erouse@comsquared.com> wrote:
> Hehe, thanks, I played around and ended up with this:
> round(SUM(extract('epoch' from (time_out - time_in))))
> I will have to do the division outside of the query, but that's really a
> minor issue.
You can always use subqueries.
> Knowing the total in seconds was the big roadblock. And
> converting back is easier (a / 3600 + ":" + a / 60 + ":" + a % 60)
> [...]
PostgreSQL has also:
| tim=# SELECT 3661::TEXT::INTERVAL;
| interval
| ----------
| 01:01:01
| (1 Zeile)
| tim=#
Tim
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: tim@tim-landscheidt.de
Subject: Re: time interval math
In-Reply-To: <m3d39oixkh.fsf@passepartout.tim-landscheidt.de>
* 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