Re: timestamp to int

From: Tomas Berndtsson <tomas(at)nocrew(dot)org>
To: Alex Pilosov <alex(at)pilosoft(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: timestamp to int
Date: 2001-07-01 08:24:57
Message-ID: 80g0chys2u.fsf@junk.nocrew.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alex Pilosov <alex(at)pilosoft(dot)com> writes:

> 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

Thank you. That wasn't too obvious to me, but quite logical when
seeing it now.

Tomas

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Trond Eivind =?iso-8859-1?q?Glomsr=F8d?= 2001-07-01 14:19:03 Re: A small question about Red Hat
Previous Message John Clark Naldoza y Lopez 2001-07-01 06:42:27 Re: A small question about Red Hat