Re: Convert "epoch" to timestamp

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Convert "epoch" to timestamp
Дата
Msg-id 20020423075313.W13153-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Convert "epoch" to timestamp  (Jeff Eckermann <jeff_eckermann@yahoo.com>)
Список pgsql-general
On Tue, 23 Apr 2002, Jeff Eckermann wrote:

> jeff=# select version();
>                               version
>
> -------------------------------------------------------------------
>  PostgreSQL 7.2 on i386-portbld-freebsd4.5, compiled
> by GCC 2.95.3
> (1 row)
>
> I need to convert the "epoch" (i.e. number of seconds)
> timestamp to a PostgreSQL timestamp.
>
> The extract/date_part functions do it easily the other
> way, but I have had some difficulty in doing what I
> need.
>
> According to posts in the archives, the following used
> to work:
>
> jeff=# select extract (epoch from
> current_timestamp(0));
>  date_part
> ------------
>  1019571752
> (1 row)
>
> jeff=# select timestamp(1019571752);
> ERROR:  TIMESTAMP(1019571752) WITH TIME ZONE precision
> must be between 0 and 13

You'd need to double quote that timestamp to differentiate
the function from the data type: "timestamp"(1019571752)



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

Предыдущее
От: Jeff Eckermann
Дата:
Сообщение: Convert "epoch" to timestamp
Следующее
От: Thomas Lockhart
Дата:
Сообщение: Re: Convert "epoch" to timestamp