Re: Trouble with UNIX TimeStamps

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jchum(at)aismedia(dot)com
Cc: "'Bruno Wolff III'" <bruno(at)wolff(dot)to>, pgsql-general(at)postgresql(dot)org
Subject: Re: Trouble with UNIX TimeStamps
Date: 2002-12-27 18:39:58
Message-ID: 25769.1041014398@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Jonathan Chum" <jchum(at)aismedia(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2002-12-27 18:51:04 Re: Storing passwords
Previous Message Ben 2002-12-27 18:32:29 Re: Trouble with UNIX TimeStamps