Re: Is TimeZone applied with TIMESTAMP WITHOUT TIME ZONE and Extract( EPOCH ...)?

From: bubba postgres <bubba(dot)postgres(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Is TimeZone applied with TIMESTAMP WITHOUT TIME ZONE and Extract( EPOCH ...)?
Date: 2011-03-17 18:24:44
Message-ID: AANLkTim166cQtLX0NJj3nPEnFy+9LV11t_yGsrvOVJ4n@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Looks like a quick search says I need to specify the timezone...

On Thu, Mar 17, 2011 at 11:22 AM, bubba postgres
<bubba(dot)postgres(at)gmail(dot)com>wrote:

>
> I'm noticing some interesting behavior around timestamp and extract epoch,
> and it appears that I'm getting a timezone applied somewhere.
>
> Specifically, If I do:
> select EXTRACT( EPOCH FROM '2010-01-31 00:00:00'::TIMESTAMP WITHOUT TIME
> ZONE ); == 1264924800
> select EXTRACT( EPOCH FROM '2010-04-01 00:00:00'::TIMESTAMP WITHOUT TIME
> ZONE ); == 1270105200
>
> Now if I do something similar in Java.. using a GregorianCalendar, with
> "GMT" TimeZone.
> I get
> Hello:2010-01-31 00:00:00.000 (UTC)
> Hello:1264896000000
>
> Hello:2010-04-01 00:00:00.000 (UTC)
> Hello:1270080000000
>
> Which gives a difference of 8 and 7 hours respectively, so both a timezone
> and a DST shift are at work here.
>
> Is this the expected behavior of extract epoch, is there a way to get it to
> always be in GMT?
>
>
>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Davenport, Julie 2011-03-17 18:29:36 Re: query taking much longer since Postgres 8.4 upgrade
Previous Message bubba postgres 2011-03-17 18:22:48 Is TimeZone applied with TIMESTAMP WITHOUT TIME ZONE and Extract( EPOCH ...)?