Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 5423110E9003 for ; Sun, 8 Jan 2012 12:19:37 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RjvT2-0001lv-Rp for pgsql-bugs@postgresql.org; Sun, 08 Jan 2012 16:19:37 +0000 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 q08GJIVm005520; Sun, 8 Jan 2012 11:19:18 -0500 (EST) To: sreeraj@ordyn.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #6385: extract epoch at timezone returns wrong value In-reply-to: References: Comments: In-reply-to sreeraj@ordyn.com message dated "Fri, 06 Jan 2012 18:10:56 +0000" Date: Sun, 08 Jan 2012 11:19:18 -0500 Message-ID: <5519.1326039558@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201201/51 X-Sequence-Number: 32118 sreeraj@ordyn.com writes: > 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 !!! I think you are confused about the sign convention for time zones specified in POSIX notation. See http://www.postgresql.org/docs/9.1/static/datatype-datetime.html#DATATYPE-TIMEZONES particularly this comment: Another issue to keep in mind is that in POSIX time zone names, positive offsets are used for locations west of Greenwich. Everywhere else, PostgreSQL follows the ISO-8601 convention that positive timezone offsets are east of Greenwich. This is not a bug, or at least not our bug --- we're just doing the best we can to cope with inconsistent standards documents. regards, tom lane