Re: Hour difference?

From: Steve Worsley <sworsley(at)commandprompt(dot)com>
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 18:47:22
Message-ID: 3F411F3A.1080400@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

fingerless=# select '7:43'::time AS start, '12:17'::time AS end,
(('12:17'::time) - ('7:43'::time))::interval AS difference;
start | end | difference
----------+----------+------------
07:43:00 | 12:17:00 | 04:34
(1 row)

Hope that helps.. Just subsitute your column names for the times.

--Steve

Bjørn T Johansen wrote:

>I need to compute the difference of Time fields, in the format HHMM. Is
>it possible to do the math in the Select?
>
>
>Regards,
>
>BTJ
>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dev 2003-08-18 18:57:12 Default Value in Table Setup Help
Previous Message Aaron 2003-08-18 18:41:21 Re: newbie and no idea