Re: int4 -> unix timestamp -> sql timestamp; abstime?

Поиск
Список
Период
Сортировка
От Roman Neuhauser
Тема Re: int4 -> unix timestamp -> sql timestamp; abstime?
Дата
Msg-id 20050112002858.GE4463@isis.wad.cz
обсуждение исходный текст
Ответ на Re: int4 -> unix timestamp -> sql timestamp; abstime?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: int4 -> unix timestamp -> sql timestamp; abstime?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
# tgl@sss.pgh.pa.us / 2005-01-11 18:35:18 -0500:
> Roman Neuhauser <neuhauser@chello.cz> writes:
> > what is the opposite of cast(extract('epoch' from now()) as int)?
> > The only thing I found that works is
> > cast(cast(... as abstime) as timestamp)
> > and the documentation says abstime shouldn't be used, and may
> > disappear. What should I use instead?
>
> The recommended locution is
>
> SELECT TIMESTAMP WITH TIME ZONE 'epoch' + <x> * INTERVAL '1 second';

    Have I missed this in the manual?

> Of course you can wrap this up in a function if you prefer (not sure why
> we haven't done so already).

    I most surely will, and I'm glad to hear this will be included in 8.1.

    Thanks for the replies!

--
FreeBSD 4.10-STABLE
1:25AM up 17:04, 9 users, load averages: 0.11, 0.06, 0.01

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

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: int4 -> unix timestamp -> sql timestamp; abstime?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: int4 -> unix timestamp -> sql timestamp; abstime?