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 5CFAE5656D for ; Thu, 10 Mar 2005 14:03:49 +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 32286-03 for ; Thu, 10 Mar 2005 14:03:43 +0000 (GMT) Received: from web41203.mail.yahoo.com (web41203.mail.yahoo.com [66.218.93.36]) by svr1.postgresql.org (Postfix) with SMTP id 347945644B for ; Thu, 10 Mar 2005 14:03:42 +0000 (GMT) Received: (qmail 10536 invoked by uid 60001); 10 Mar 2005 14:03:46 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=Gbtzc2a/QC0/7Kh3OvKmyCG228GP4AR0/tmiafSRDlqu6qc3v4Etq8sNKbxelN+O29vmNZ3Zv3Dqvxg70bN1SCSmJpCpEWScCzf37HMu4MpRpAtUNJItcmYttcqlBi6Z5PIePEyISPfoZDhIDsjrigU1TTNJf6SMGNtsXD9vBr4= ; Message-ID: <20050310140345.10534.qmail@web41203.mail.yahoo.com> Received: from [212.108.30.65] by web41203.mail.yahoo.com via HTTP; Thu, 10 Mar 2005 14:03:45 GMT Date: Thu, 10 Mar 2005 14:03:45 +0000 (GMT) From: Charl Gerber Subject: timestamp issues To: pgsql-jdbc@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.175 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200503/100 X-Sequence-Number: 12492 I have a machine physically located in the USA, but the OS (Linux) time is set to New Zealand time. So if I execute "date" on the command prompt, I get the New Zealand time. I have java classes converting all time to timezone "Europe/Amsterdam". 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. If, however, I change the update to this: "UPDATE users SET last_login=?" with prepareStatement.setTimestamp(1, new Timestamp( System.currentTimeMillis()); Then the java classes see the time correct as it should. Why is this? Why does System.currentTimeMillis() and current_time give different times?