Re: adding times togeather

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: ed despard <despareg(at)clarkson(dot)edu>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: adding times togeather
Date: 2003-04-28 22:40:36
Message-ID: Pine.LNX.4.33.0304281639070.14672-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 28 Apr 2003, ed despard wrote:

> what i have is two columns that represent the times for sections of a
> race, so i have column A that is say 0:20:23 and i have column B that
> is 0:21:45 and i want to have a column that is A+B where that would be
> 0:42:18 in this case.

Store them as intervals and you can do that pretty easily:

create table th (n interval, p interval);
CREATE TABLE
marl8412=# insert into th values ('00:02:23','00:03:43');
INSERT 4505763 1
marl8412=# select n+p as time from th;
time
----------
00:06:06

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dennis Gearon 2003-04-28 22:58:22 Re: encrypt/decrypt problem
Previous Message ed despard 2003-04-28 22:36:04 Re: adding times togeather