Re: ResultSet.getTimestamp(Calendar) off by one-hour

From: Roland Roberts <roland(at)astrofoto(dot)org>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: ResultSet.getTimestamp(Calendar) off by one-hour
Date: 2009-03-13 20:31:40
Message-ID: 49BAC2AC.1010505@astrofoto.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Tom Lane wrote:
> Apparently you're using a timestamp WITHOUT time zone column to store
> the data. Not recommended if you are worried about timezone effects,
> since by definition the apparent value depends on caller's timezone
> context. Use timestamp WITH time zone and see if it gets better.
>
Ultimately, I need something that will be (mostly) compatible across
different databases. The application will be using Hibernate and
switching datasources will be routine, especially as part of the testing
process. To that end, I'm using a user defined type with Hibernate to
intercept the database access and store and retrieve times in UTC
regardless of the local JVM time.

I can certainly try timestamp with time zone, but the plan is to deploy
with a column that does not include time zone because all times are
supposed to be stored in UTC. And clients WILL be connecting from other
time zones.

Based on the tests I just ran, it looks like the JVM doesn't understand
the local time zone. Although my host sure seems to know that the zone
is America/New_York, the JVM is telling me it is GMT-05:00. I'm not
sure why, but it doesn't really look like a postgresql problem at this
point.

roland

--
PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD RL Enterprises
roland(at)rlenter(dot)com 6818 Madeline Court
roland(at)astrofoto(dot)org Brooklyn, NY 11220

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Roland Roberts 2009-03-13 20:46:58 Re: ResultSet.getTimestamp(Calendar) off by one-hour
Previous Message Tom Lane 2009-03-13 20:16:35 Re: ResultSet.getTimestamp(Calendar) off by one-hour