Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: [JDBC] Timestamp problem

From: Oliver Jowett <oliver(at)opencloud.com>
Date: Thu Jan 03 2008 - 13:49:36 EST


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

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match
Received on Thu Jan 3 13:52:05 2008

This archive was generated by hypermail 2.1.8 : Wed Jun 18 2008 - 23:42:02 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library