Re: strange TIME behaviour

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: strange TIME behaviour
Дата
Msg-id 20070915122510.GA72089@winnie.fuhr.org
обсуждение исходный текст
Ответ на strange TIME behaviour  (rihad <rihad@mail.ru>)
Ответы Re: strange TIME behaviour  (rihad <rihad@mail.ru>)
Re: strange TIME behaviour  (rihad <rihad@mail.ru>)
Список pgsql-general
On Sat, Sep 15, 2007 at 04:45:02PM +0500, rihad wrote:
> Can someone please explain to me why these two give different results?
> The idea is to get the number of seconds past 00:00:00, so the second
> one is obviously correct.

They're both correct.

> foo=> select extract(epoch from current_time);
>   date_part
> --------------
>  42023.026348
> (1 row)

current_time is a time with time zone; the above query returns the
number of seconds since 00:00:00 UTC.

> foo=> select extract(epoch from cast(current_time as time));
>   date_part
> --------------
>  60030.824587
> (1 row)

By casting current_time to time without time zone you're now getting
the number of seconds since 00:00:00 in your local time zone.

--
Michael Fuhr

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

Предыдущее
От: Ron Johnson
Дата:
Сообщение: Re: strange TIME behaviour
Следующее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: Locking entire database