Re: Hour difference?

From: Jonathan Bartlett <johnnyb(at)eskimo(dot)com>
To: Bruno Wolff III <bruno(at)wolff(dot)to>
Cc: Bjørn T Johansen <btj(at)havleik(dot)no>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Hour difference?
Date: 2003-08-18 18:19:35
Message-ID: Pine.GSU.4.44.0308181118550.16896-100000@eskimo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is there a way to get an interval in a standard format? It seems like it
keeps changing it's ouput style based on the time length.

Jon

On Mon, 18 Aug 2003, Bruno Wolff III wrote:

> On Mon, Aug 18, 2003 at 16:09:43 +0200,
> Bjrn 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.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2003-08-18 18:25:08 Re: newbie and no idea
Previous Message Tom Lane 2003-08-18 17:59:01 Re: Simulating sequences