Re: Converting seconds past midnight to a time - Mailing list pgsql-general

From Tom Lane
Subject Re: Converting seconds past midnight to a time
Date
Msg-id 13109.1134879985@sss.pgh.pa.us
Whole thread Raw
In response to Converting seconds past midnight to a time  ("Karl O. Pinc" <kop@meme.com>)
List pgsql-general
"Karl O. Pinc" <kop@meme.com> writes:
> What is the best way to convert an integer number of
> seconds past midnight into a time?

Intermediate 'interval' value seems to work:

regression=# select (99.44 * '1 second'::interval)::time;
    time
-------------
 00:01:39.44
(1 row)

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

Again, multiplying the number by '1 sec'::interval would get you there.

            regards, tom lane

pgsql-general by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: Converting seconds past midnight to a time
Next
From: "Karl O. Pinc"
Date:
Subject: Re: Converting seconds past midnight to a time