Re: timestamp <-> ctime conversion question...

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: timestamp <-> ctime conversion question...
Дата
Msg-id 8305.1134496150@sss.pgh.pa.us
обсуждение исходный текст
Ответ на timestamp <-> ctime conversion question...  (Alex Mayrhofer <axelm@nona.net>)
Ответы Re: timestamp <-> ctime conversion question...  (Michael Glaesemann <grzm@myrealbox.com>)
Setting expire date on insert/modify  ("Foster, Stephen" <stephenlfoster@comcast.net>)
Список pgsql-general
Alex Mayrhofer <axelm@nona.net> writes:
> i'm trying to convert time stamps to "seconds since epoch" and back.

> test=# SELECT (TIMESTAMP WITH TIME ZONE 'epoch'
>                  + 0 * INTERVAL '1 second') AT TIME ZONE 'UTC';

You're overthinking the problem.  It should be just

    SELECT (TIMESTAMP WITH TIME ZONE 'epoch' + n * INTERVAL '1 second')

There is a built-in function to_timestamp() equivalent to this in 8.1,
though it doesn't seem to have made it into the documentation :-(

            regards, tom lane

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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Bug#342369: PostgreSQL 8.1.0 RHEL / Debian incompatible
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Memory Leakage Problem