On Dec 18, 2005, at 13:25 , Karl O. Pinc wrote:

What is the best way to convert an integer number of
seconds past midnight into a time?

Try your_date::timestamptz + your_seconds * interval '1 sec', e.g.,

test=# select current_date::timestamptz, current_date::timestamptz + 1000 * interval '1 sec';
      timestamptz       |        ?column?
------------------------+------------------------
2005-12-18 00:00:00+09 | 2005-12-18 00:16:40+09
(1 row)

On a related note is there some reason why
interval + int
does not result in the interval plus int number
of seconds?

Why should the int necessarily represent seconds and not some other amount of time? It's just a unit-less value.

Michael Glaesemann
grzm myrealbox com




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

              http://archives.postgresql.org

Reply via email to