Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 3C890B0F616 for ; Fri, 6 Jan 2012 14:11:13 -0400 (AST) Received: from mahout.postgresql.org ([98.129.198.123]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RjEFy-0002Pc-A2 for pgsql-bugs@postgresql.org; Fri, 06 Jan 2012 18:11:12 +0000 Received: from [204.145.120.229] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RjEFl-0003HM-2l for pgsql-bugs@postgresql.org; Fri, 06 Jan 2012 18:10:57 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1RjEFk-0007oL-OF for pgsql-bugs@postgresql.org; Fri, 06 Jan 2012 18:10:56 +0000 Date: Fri, 06 Jan 2012 18:10:56 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #6385: extract epoch at timezone returns wrong value To: pgsql-bugs@postgresql.org From: sreeraj@ordyn.com X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201201/48 X-Sequence-Number: 32115 The following bug has been logged on the website: Bug reference: 6385 Logged by: Sreeraj S Email address: sreeraj@ordyn.com PostgreSQL version: 9.1.2 Operating system: Windows Vista Professional Description: = Below is given psql output - I am in timezone UTC+05:30 (India) as shown by select now() output below. When I give "SELECT extract(epoch from now() );" the output is 1325872658.xxx = I would expect a slightly incremented value when after a few seconds I give the command "SELECT extract(epoch from now() at time zone 'utc+05:30');" . Nut I get the value 1325833067.xxx which is the value for utc-05:30 !!! And when I give "SELECT extract(epoch from now() at time zone 'utc-05:30');", I get 1325872672.xxx which is what is expected if I specified timezone +05:30 !!! ----- psql extract below ------ ordprdlic=3D> select now(); now ------------------------------- 2012-01-06 23:27:35.663+05:30 (1 row) ordprdlic=3D> SELECT extract(epoch from now() ); date_part ---------------- 1325872658.608 (1 row) ordprdlic=3D> SELECT extract(epoch from now() at time zone 'utc+05:30'); date_part ---------------- 1325833067.073 (1 row) ordprdlic=3D> SELECT extract(epoch from now() at time zone 'utc-05:30'); date_part ---------------- 1325872672.977 (1 row)