pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: sreeraj@ordyn.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6385: extract epoch at timezone returns wrong value
Date: Sun, 08 Jan 2012 11:19:18 -0500
Message-ID: <5519.1326039558@sss.pgh.pa.us> (raw)
In-Reply-To: <E1RjEFk-0007oL-OF@wrigleys.postgresql.org>
References: <E1RjEFk-0007oL-OF@wrigleys.postgresql.org>

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



view thread (2+ messages)

Message-ID: <5519.1326039558@sss.pgh.pa.us>
Permalink:  ../5519.1326039558@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5519.1326039558@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, sreeraj@ordyn.com
  Subject: Re: BUG #6385: extract epoch at timezone returns wrong value
  In-Reply-To: <5519.1326039558@sss.pgh.pa.us>
  References: <E1RjEFk-0007oL-OF@wrigleys.postgresql.org> <5519.1326039558@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox