Re: Hour difference?

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Bjørn T Johansen <btj(at)havleik(dot)no>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Hour difference?
Date: 2003-08-18 15:55:30
Message-ID: 20030818155530.GB20703@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Aug 18, 2003 at 16:09:43 +0200,
Bjørn T Johansen <btj(at)havleik(dot)no> wrote:
> I need to compute the difference of Time fields, in the format HHMM. Is
> it possible to do the math in the Select?

Despite what it says in the documentation, you can't use that format
for the type time.
If timestamps will work for you, you can use to_timestamp to convert
to a timestamps and then subtract them to get an interval.
Another option would be to massage the strings to use a : separator
between the hours and minutes fields and then cast the strings to times.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bjørn T Johansen 2003-08-18 15:56:00 Re: Hour difference?
Previous Message scott.marlowe 2003-08-18 15:54:55 Re: query tuning