Re: cast time interval to seconds

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: rihad <rihad(at)mail(dot)ru>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: cast time interval to seconds
Date: 2007-09-10 15:58:11
Message-ID: DB657E60-1C61-417E-B042-CD812FB8216C@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2007-09-10 16:01:14 Re: cast time interval to seconds
Previous Message Scott Marlowe 2007-09-10 15:55:07 Re: Time Zone design issues