Re: BUG #5031: DATE_TRUNC returns the wrong value when specifying MONTH

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #5031: DATE_TRUNC returns the wrong value when specifying MONTH
Дата
Msg-id 8052.1251954104@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #5031: DATE_TRUNC returns the wrong value when specifying MONTH  ("Mark Douglas" <mark@steelhousemedia.com>)
Ответы Re: BUG #5031: DATE_TRUNC returns the wrong value when specifying MONTH  (Mark Douglas <mark@steelhousemedia.com>)
Список pgsql-bugs
"Mark Douglas" <mark@steelhousemedia.com> writes:
> The following use of DATE_TRUNC returns the wrong value. I called the
> function on 2009-09-02. It should return '2009-09-01 00:00:00' for the
> following usage:

> SELECT DATE_TRUNC('MONTH', CURRENT_DATE);

> It instead returns '2009-08-31 17:00:00.

Really?  What timezone setting are you using?  I get

postgres=# SELECT DATE_TRUNC('MONTH', CURRENT_DATE);
       date_trunc
------------------------
 2009-09-01 00:00:00-04
(1 row)

with timezone set to 'America/New_York' or equivalent.
This test might also be instructive:

postgres=# select CURRENT_DATE::timestamptz;
      timestamptz
------------------------
 2009-09-03 00:00:00-04
(1 row)


            regards, tom lane

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: BUG #5032: unexpected syntax error for plpgsql function returns table
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5031: DATE_TRUNC returns the wrong value when specifying MONTH