Re: ResultSet.getTimestamp(Calendar) off by one-hour - Mailing list pgsql-jdbc

From Roland Roberts
Subject Re: ResultSet.getTimestamp(Calendar) off by one-hour
Date
Msg-id 49BAC2AC.1010505@astrofoto.org
Whole thread Raw
In response to Re: ResultSet.getTimestamp(Calendar) off by one-hour  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: ResultSet.getTimestamp(Calendar) off by one-hour  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@rlenter.com                            6818 Madeline Court
roland@astrofoto.org                           Brooklyn, NY 11220


pgsql-jdbc by date:

Previous
From: Tom Lane
Date:
Subject: Re: ResultSet.getTimestamp(Calendar) off by one-hour
Next
From: Roland Roberts
Date:
Subject: Re: ResultSet.getTimestamp(Calendar) off by one-hour