cast time interval to seconds

From: rihad <rihad(at)mail(dot)ru>
To: pgsql-general(at)postgresql(dot)org
Subject: cast time interval to seconds
Date: 2007-09-10 15:44:07
Message-ID: 46E56647.5060604@mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, I have two columns start_time & stop_time declared as "TIME". I'd
like to compute the difference between the two times in seconds, all in db:

SELECT
(CAST(stop_time AS SECONDS) + 86400 - CAST(start_time AS SECONDS))
% 86400;

Unfortunately AS SECONDS causes parse error. Any hints? Thanks.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2007-09-10 15:51:35 Re: Time Zone design issues
Previous Message Alvaro Herrera 2007-09-10 15:40:11 Re: Checking is TSearch2 query is valid