pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: sreeraj@ordyn.com
To: pgsql-bugs@postgresql.org
Subject: BUG #6385: extract epoch at timezone returns wrong value
Date: Fri, 06 Jan 2012 18:10:56 +0000
Message-ID: <E1RjEFk-0007oL-OF@wrigleys.postgresql.org> (raw)

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=> select now();
              now
-------------------------------
 2012-01-06 23:27:35.663+05:30
(1 row)


ordprdlic=> SELECT extract(epoch from now() );
   date_part
----------------
 1325872658.608
(1 row)


ordprdlic=> SELECT extract(epoch from now() at time zone 'utc+05:30');
   date_part
----------------
 1325833067.073
(1 row)


ordprdlic=> SELECT extract(epoch from now() at time zone 'utc-05:30');
   date_part
----------------
 1325872672.977
(1 row)





view thread (2+ messages)  latest in thread

Message-ID: <E1RjEFk-0007oL-OF@wrigleys.postgresql.org>
Permalink:  ../E1RjEFk-0007oL-OF@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1RjEFk-0007oL-OF@wrigleys.postgresql.org

 · 

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: sreeraj@ordyn.com
  Subject: Re: BUG #6385: extract epoch at timezone returns wrong value
  In-Reply-To: <E1RjEFk-0007oL-OF@wrigleys.postgresql.org>
  References: <E1RjEFk-0007oL-OF@wrigleys.postgresql.org>

* 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