X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0E30F565C6 for ; Thu, 10 Mar 2005 20:39:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51872-10 for ; Thu, 10 Mar 2005 20:39:05 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id D17DF565C4 for ; Thu, 10 Mar 2005 20:39:03 +0000 (GMT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.21]) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1D9UQu-00013T-00; Fri, 11 Mar 2005 09:39:01 +1300 Message-ID: <4230B065.2040605@opencloud.com> Date: Thu, 10 Mar 2005 20:39:01 +0000 From: Oliver Jowett User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Charl Gerber Cc: pgsql-jdbc@postgresql.org Subject: Re: timestamp issues References: <20050310140345.10534.qmail@web41203.mail.yahoo.com> In-Reply-To: <20050310140345.10534.qmail@web41203.mail.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/102 X-Sequence-Number: 12494 Charl Gerber wrote: > I have tables with "TIMESTAMP" fields (no timezone). > > If I do this (through a JDBC call): > > "UPDATE users SET last_login=current_timestamp" > > then the database explorer shows the times in New > Zealand time, as expected. But my the Java classes see > the time (after converting the time to the Amsterdam > timezone) as 19 hours ahead of Amsterdam time. (19 > hours is, I think, the difference between the USA and > New Zealand times?). I also tried with LOCALTIMESTAMP > instead of current_timestamp, same result. When you use getTimestamp() on a timestamp-without-timezone column, the JDBC driver treats it as a timestamp in the (Java client's) default timezone, a US timezone in your case I believe. In theory you can pass an appropriate Calendar object to getTimestamp() to tell the driver to treat it as a timestamp in that timezone if no timezone information is associated with the timestamp column. The code looks a bit hairy though, I'd be interested to know if this actually works. -O