Re: Hour difference?

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

I am already using Time for time fields (i.e. timestamp fields without
the date part) in my database, are you saying this doesn't work???

BTJ

On Mon, 2003-08-18 at 17:55, Bruno Wolff III wrote:
> 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.
--
-----------------------------------------------------------------------------------------------
Bjørn T Johansen (BSc,MNIF)
Executive Manager
btj(at)havleik(dot)no Havleik Consulting
Phone : +47 67 54 15 17 Conradisvei 4
Fax : +47 67 54 13 91 N-1338 Sandvika
Cellular : +47 926 93 298 http://www.havleik.no
-----------------------------------------------------------------------------------------------
"The stickers on the side of the box said "Supported Platforms: Windows
98, Windows NT 4.0,
Windows 2000 or better", so clearly Linux was a supported platform."
-----------------------------------------------------------------------------------------------

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message btober 2003-08-18 16:01:41 Re: Simulating sequences
Previous Message Bruno Wolff III 2003-08-18 15:55:30 Re: Hour difference?