Search Postgresql Archives

Re: cast time interval to seconds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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



---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux