Re: Convert from unixtime?

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Convert from unixtime?
Дата
Msg-id 20030322160200.GA14964@wolff.to
обсуждение исходный текст
Ответ на Convert from unixtime?  (Forjan Tamas <tamas@2fkft.com>)
Ответы Re: Convert from unixtime?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
On Wed, Mar 19, 2003 at 20:07:14 +0100,
  Forjan Tamas <tamas@2fkft.com> wrote:
> Greetings.
>
> I have some data files that I need to put into a database. My problem is
> that all date fields are in unix time format (seconds since 1970.01.01
> 0:00). What I would like to find is a function that could be used in
> INSERT commands to convert such data into a date format understandable to
> Postgres. Any ideas?

You can do something like this (in 7.3):

select 1::abstime::timestamp with time zone;
or
select 1::abstime::timestamp with time zone at time zone 'GMT'::timestamp;

Depending on whether or not you want a time zone associated with the
timestamp. Note that if you go directly from abstime to timestamp
(without time zone), then the time will be off by your offset from GMT.


В списке pgsql-novice по дате отправления:

Предыдущее
От: brew@theMode.com
Дата:
Сообщение: Re: Problems when deleting data.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Just to ascertain why my posts are going astray