Re: unixtime -> timestamp with time zone

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ben <bench(at)silentmedia(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: unixtime -> timestamp with time zone
Date: 2002-12-03 06:30:15
Message-ID: 20694.1038897015@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ben <bench(at)silentmedia(dot)com> writes:
> I have a lot of date data in unixtime format, which I'd like to store in
> postgres as a timestamp with time zone. In 7.2 I had been able to say:
> datetime(1038812385) at time zone 'pst'
> which worked great, but in 7.3 this is telling me:
> ERROR: Function datetime(integer) does not exist

The datetime datatype name has been a deprecated alias for several
releases now; it's gone entirely in 7.3.

> How can I convert from unixtime to timestamp with time zone?

Try abstime (which is what you were really depending on, anyway):

regression=# select abstime(1038812385);
abstime
------------------------
2002-12-02 01:59:45-05
(1 row)

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-12-03 06:52:57 Re: Segmentation fault while COPY in 7.3
Previous Message Madhavi 2002-12-03 05:32:54 MORE INFORMATION ABOUT PGMAIL