Re: Timestamp problem - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Timestamp problem
Date
Msg-id 477D2E40.4020105@opencloud.com
Whole thread Raw
In response to Timestamp problem  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Timestamp problem
List pgsql-jdbc
Peter Eisentraut wrote:

> Note,
> however, that this application does not use time zones or time-zone aware
> data types at all.  It merely wishes to store '2007-03-25 02:30:00' and
> retrieve it in identical form.

getTimestamp() must convert the retrieved timestamp to *some* timezone
since Timestamp is only meaningful in a particular timezone. If you
don't pass an explicit Calendar, it uses the default JVM timezone. If
you want to avoid DST and similar you should explicitly pass a Calendar
object to Timestamp for a timezone that does not use daylight savings
(e.g. UTC) and use the same timezone to interpret the Timestamp.

The internal representation of java.sql.Timestamp (which is out our
control) is seconds-since-epoch, so you simply can't represent all
possible times-without-timezone if you interpret that using rules from a
timezone with daylight savings. In your case there is no possible
seconds-since-epoch value that will represent '2007-03-25 02:30:00' in
your default timezone.

-O

pgsql-jdbc by date:

Previous
From: "Jake Aderholdt"
Date:
Subject: JDBC driver class
Next
From: "Albe Laurenz"
Date:
Subject: Re: JDBC driver class