| From: | David Fetter <david(at)fetter(dot)org> | 
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
| Cc: | Roman Neuhauser <neuhauser(at)chello(dot)cz>, pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: int4 -> unix timestamp -> sql timestamp; abstime? | 
| Date: | 2005-01-12 00:40:25 | 
| Message-ID: | 20050112004024.GA3847@fetter.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
On Tue, Jan 11, 2005 at 06:35:18PM -0500, Tom Lane wrote:
> Roman Neuhauser <neuhauser(at)chello(dot)cz> writes:
> > what is the opposite of cast(extract('epoch' from now()) as int)?
> > The only thing I found that works is
> > cast(cast(... as abstime) as timestamp)
> > and the documentation says abstime shouldn't be used, and may
> > disappear. What should I use instead?
> 
> The recommended locution is
> 
> SELECT TIMESTAMP WITH TIME ZONE 'epoch' + <x> * INTERVAL '1 second';
I think this should read:
SELECT TIMESTAMP WITH TIME ZONE 'epoch' AT TIME ZONE 'UTC' + <x> * INTERVAL '1 second';
/*                                      ^^^^^^^^^^^^^^^^^^ */
to conform with the *n*x standard.
Cheers,
D
-- 
David Fetter david(at)fetter(dot)org http://fetter.org/
phone: +1 510 893 6100   mobile: +1 415 235 3778
Remember to vote!
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2005-01-12 00:44:46 | Re: int4 -> unix timestamp -> sql timestamp; abstime? | 
| Previous Message | Tom Lane | 2005-01-12 00:31:19 | Re: int4 -> unix timestamp -> sql timestamp; abstime? |