Re: timestamp to int - Mailing list pgsql-general

From Alex Pilosov
Subject Re: timestamp to int
Date
Msg-id Pine.BSO.4.10.10106300916560.7004-100000@spider.pilosoft.com
Whole thread Raw
In response to Re: timestamp to int  (Tomas Berndtsson <tomas@nocrew.org>)
Responses Re: timestamp to int  (Tomas Berndtsson <tomas@nocrew.org>)
List pgsql-general
On 30 Jun 2001, Tomas Berndtsson wrote:

> > certainly not date_part or to_char or to_date. they're not
> > mentioned in the docs, either, so don't bother looking.
> > (think of the time you'll save.)
> >
> > in particular, on my debian system, you wouldn't look in
> > /usr/share/doc/postgresql-doc/html/postgres/postgres.htm
> > and you wouldn't do
> >
> >     cd /usr/share/doc/postgresql-doc/html/postgres
> >     grep -i epoch *
> >
> > that would be bad.
>
> I sense a touch of sarcasm. Yet, having looked (yes, before I mailed,
> and now again after), I still can't find a way to create a timestamp
> from an integer. You may call me stupid, but I'd be glad to see how
> it's done.
Quite strangely, there's no argument for to_date to do conversion from
'seconds since epoch'. At any case, this is how you do it:

select 'epoch'::timestamp + (x || ' seconds')::interval

-alex


pgsql-general by date:

Previous
From: Tomas Berndtsson
Date:
Subject: Re: timestamp to int
Next
From: Doug McNaught
Date:
Subject: Re: Re: useability of apache, PHP, Postgres for real business apps