Re: Convert from unixtime?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Convert from unixtime?
Дата
Msg-id 772.1048350089@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Convert from unixtime?  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-novice
Bruno Wolff III <bruno@wolff.to> writes:
> 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.

It seems to me that that case also produces sensible results:

regression=# select 1::abstime::timestamp without time zone ;
      timestamp
---------------------
 1969-12-31 19:00:01
(1 row)

This corresponds to my local time (EST) at unix timestamp 1, which is
exactly what timestamp without time zone ought to show.

Obviously, which of these you want to use depends on what your goal is,
but they all give useful behaviors IMHO.

            regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Just to ascertain why my posts are going astray
Следующее
От: Ennio Iannucci
Дата:
Сообщение: Extended display and extended ascii characters