Re: adding times togeather

From: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
To: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
Cc: ed despard <despareg(at)clarkson(dot)edu>, pgsql-general(at)postgresql(dot)org
Subject: Re: adding times togeather
Date: 2003-04-28 22:34:03
Message-ID: Pine.LNX.4.21.0304282330280.7284-100000@ponder.fairway2k.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 28 Apr 2003, Steve Crawford wrote:

> I can't tell what you want. Adding two times doesn't make sense. What is
> 3:15pm + 4:30am or 5:15 April 3 2003 + 4:27 June 14 1997. No such beast
> exists. I suspect that one of your "times" is really an interval.
>
> You can:
> Subtract two times and get an interval
> Add an interval to a time to get a time
> Add two intervals to get an interval

This obviously tells you how to achieve what you want, ie.

select time1 + (time2 - '0 seconds'::interval)

but there's still the meaning issue.

>
> What are you trying to do? It might help to tell us what the two columns
> represent and what the result is supposed to represent.
>
> Cheers,
> Steve
>
>
> On Monday 28 April 2003 3:17 pm, ed despard wrote:
> > i have two collumns of type time, and i want to get the result of the
> > two times added togeather. how do i go about doing this? i could use
> > timestamps instead of times if necessary, but all the date/time
> > functions seem to want to add intervals to things.
> >
> > thanks,
> > ed

--
Nigel J. Andrews

In response to

Browse pgsql-general by date

  From Date Subject
Next Message ed despard 2003-04-28 22:36:04 Re: adding times togeather
Previous Message Nigel J. Andrews 2003-04-28 22:29:10 Re: timestamps and dates