From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Karl O(dot) Pinc" <kop(at)meme(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: [GENERAL] Converting seconds past midnight to a time |
Date: | 2005-12-21 16:04:34 |
Message-ID: | 200512211604.jBLG4Yn28745@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-patches |
Tom Lane wrote:
> "Karl O. Pinc" <kop(at)meme(dot)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.
I have applied the following documentation patch to HEAD and 8.1.X.
It is unified diff because those are easier with single-line changes
like this, where the surrounding text isn't as significant.
I also fixed an example '1 day' - '1 hour' which now computes
differently, and added trailing zero seconds, which is our display
default.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 4.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Jerry LeVan | 2005-12-21 19:12:43 | Funky template1 problem? |
Previous Message | Seneca Cunningham | 2005-12-21 15:48:03 | Re: out of memory during query execution |
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2005-12-21 16:23:52 | Re: COPY LOCK for WAL bypass |
Previous Message | Bruce Momjian | 2005-12-21 13:18:15 | Re: COPY LOCK for WAL bypass |