Re: Convert "epoch" to timestamp

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Convert "epoch" to timestamp
Дата
Msg-id 20464.1019574295@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Convert "epoch" to timestamp  (Jeff Eckermann <jeff_eckermann@yahoo.com>)
Список pgsql-general
Jeff Eckermann <jeff_eckermann@yahoo.com> writes:
> According to posts in the archives, the following used
> to work:

> jeff=# select timestamp(1019571752);
> ERROR:  TIMESTAMP(1019571752) WITH TIME ZONE precision
> must be between 0 and 13
> jeff=#

Still works if you quote it:

regression=# select "timestamp"(1019571752);
      timestamp
---------------------
 2002-04-23 10:22:32
(1 row)

regression=# select "timestamptz"(1019571752);
      timestamptz
------------------------
 2002-04-23 10:22:32-04
(1 row)

However, the cast to abstime may be preferable, since Thomas is unlikely
to keep fiddling with the syntax and semantics of that type ;-) ;-).

Eventually there should be an exact converse of the extract(epoch)
functionality, rather than these various kluges relying on
abstime-to-integer equivalence.

We'll probably start thinking about removing abstime when Unix systems
start to migrate away from 32-bit time_t, which one hopes will happen
well before the year 2038.  So eventually something's got to be done.

            regards, tom lane

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

Предыдущее
От: Thomas Lockhart
Дата:
Сообщение: Re: Convert "epoch" to timestamp
Следующее
От: Alejandro Fernandez
Дата:
Сообщение: Connections per second?