Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 65C2B133655C for ; Fri, 18 Mar 2011 12:42:03 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 03815-03-3 for ; Fri, 18 Mar 2011 15:41:55 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id E12C61337C04 for ; Fri, 18 Mar 2011 12:41:47 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p2IFfiUo015709; Fri, 18 Mar 2011 11:41:44 -0400 (EDT) To: JB@BlackSkyTech.com cc: pgsql-bugs@postgresql.org Subject: Re: TO_CHAR(timestamptz,datetimeformat) wrong after DST change In-reply-to: <004c01cbe57c$7d920ca0$78b625e0$@com> References: <004c01cbe57c$7d920ca0$78b625e0$@com> Comments: In-reply-to "Jonathan Brinkman" message dated "Fri, 18 Mar 2011 10:55:03 -0400" Date: Fri, 18 Mar 2011 11:41:43 -0400 Message-ID: <15708.1300462903@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201103/247 X-Sequence-Number: 29757 "Jonathan Brinkman" writes: > My TO_CHAR function is now an hour off thanks to Daylight Savings Time. > The dates are correct (I'm in EST: TZ=-04) but my function now returns TIME > an hour early. > (prior to DST we were TZ=-05). > TIMESTAMPTZ data (v_dt): 2011-03-17 18:21:50-04 > FUNCTION SNIPPET: to_char(v_dt, 'mm/dd/yyyy hh:mi AM') > FUNCTION RETURNS: 03/18/2011 09:21 AM > FUNCTION SHOULD RETURN: 03/18/2011 10:21 AM > postgres=# show time zone; > TimeZone > ------------------ > America/New_York > (1 row) Works for me: regression=# set timezone = 'America/New_York'; SET regression=# select now(); now ------------------------------- 2011-03-18 11:39:45.124162-04 (1 row) regression=# select to_char(now(), 'mm/dd/yyyy hh:mi AM'); to_char --------------------- 03/18/2011 11:39 AM (1 row) Are you sure your application is running with the timezone setting you think it is? regards, tom lane