Re: cast time interval to seconds - Mailing list pgsql-general

From Michael Glaesemann
Subject Re: cast time interval to seconds
Date
Msg-id DB657E60-1C61-417E-B042-CD812FB8216C@seespotcode.net
Whole thread Raw
In response to cast time interval to seconds  (rihad <rihad@mail.ru>)
List pgsql-general
On Sep 10, 2007, at 10:44 , rihad wrote:

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

"seconds" isn't a datatype. Try extract(epoch from (stop_time -
start_time))

The manual is quite extensive:

http://www.postgresql.org/docs/8.2/interactive/functions-
datetime.html#FUNCTIONS-DATETIME-EXTRACT

Michael Glaesemann
grzm seespotcode net



pgsql-general by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: Time Zone design issues
Next
From: Martijn van Oosterhout
Date:
Subject: Re: cast time interval to seconds