Skip site navigation (1) Skip section navigation (2)

Re: /contrib/unixdate: Broke in cvs tip.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Larry Rosenman <ler(at)lerctr(dot)org>
Cc: PostgreSQL Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: /contrib/unixdate: Broke in cvs tip.
Date: 2001-05-29 14:13:16
Message-ID: 18446.991145596@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Larry Rosenman <ler(at)lerctr(dot)org> writes:
> I tried to use the unixdate contrib, and got the following:

I think unixdate is suffering from bit-rot.  Most or all of what it
does is now part of the mainframe anyway.

> Any ideas? (I need SOMETHING that takes a unix timestamp and turns it
> to timestamp. )

There are a number of ways.  I tend to rely on the binary equivalence
between int4 and abstime:

regression=# select now()::abstime::int4;
 ?column?
-----------
 991145365
(1 row)

regression=# select 991145365::int4::abstime::timestamp;
        ?column?
------------------------
 2001-05-29 10:09:25-04
(1 row)

but the more officially supported way to do the former is
date_part('epoch', timestamp), and I think there is also an
Approved Way to do the latter.  (Thomas?)

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: mlwDate: 2001-05-29 14:45:54
Subject: Re: *really* simple select doesn't use indices ...
Previous:From: The Hermit HackerDate: 2001-05-29 14:13:07
Subject: Re: appendum: Re: *really* simple select doesn't use indices ...

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group