Re: Trouble with UNIX TimeStamps - Mailing list pgsql-general

From Tom Lane
Subject Re: Trouble with UNIX TimeStamps
Date
Msg-id 25769.1041014398@sss.pgh.pa.us
Whole thread Raw
In response to Re: Trouble with UNIX TimeStamps  ("Jonathan Chum" <jchum@aismedia.com>)
List pgsql-general
"Jonathan Chum" <jchum@aismedia.com> writes:
> ERROR:  Cannot cast type integer to timestamp with time zone

A solution with less notational cruft is to cast the integer to abstime:

regression=# select 1040999196::abstime;
        abstime
------------------------
 2002-12-27 09:26:36-05
(1 row)

regression=# select to_char(1040999196::abstime, 'Day');
  to_char
-----------
 Friday
(1 row)

abstime is a deprecated datatype if you believe the manual, but I
seriously doubt that we'll remove it anytime soon.  Maybe when Y2038
is upon us (by which time you'd better have found another representation
for your table, anyway).

            regards, tom lane

pgsql-general by date:

Previous
From: Ben
Date:
Subject: Re: Trouble with UNIX TimeStamps
Next
From: Bruce Momjian
Date:
Subject: Re: Storing passwords