From: | Mark Douglas <mark(at)steelhousemedia(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: BUG #5031: DATE_TRUNC returns the wrong value when specifying MONTH |
Date: | 2009-09-03 05:06:03 |
Message-ID: | C6C49CCB.FFB%mark@steelhousemedia.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
I have my timezone set to GMT so there really shouldn't be any time zone adjustments.
Mark
On 9/2/09 10:01 PM, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
"Mark Douglas" <mark(at)steelhousemedia(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-09-03 05:24:27 | Re: BUG #5031: DATE_TRUNC returns the wrong value when specifying MONTH |
Previous Message | Tom Lane | 2009-09-03 05:01:44 | Re: BUG #5031: DATE_TRUNC returns the wrong value when specifying MONTH |