Skip site navigation (1) Skip section navigation (2)

Re: Date problem on Aix jdk1.4.1

From: "Byron Nikolaidis" <ByronN(at)Routescape(dot)com>
To: "Oliver Jowett" <oliver(at)opencloud(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Date problem on Aix jdk1.4.1
Date: 2005-07-27 23:20:24
Message-ID: 6E0907A94904D94B99D7F387E08C4F570732F0@FALCON.INSIGHT (view raw or flat)
Thread:
Lists: pgsql-jdbc
Here is a really simple test:

public class DateTest {

    public static void main(String[] args) throws Exception {
        Class.forName("org.postgresql.Driver");
        Connection connection =
DriverManager.getConnection("jdbc:postgresql://host/db");
        Statement statement = connection.createStatement();
        ResultSet rs = statement.executeQuery("select id, effective from
date_test");
        while(rs.next() ) {
            Date effective = rs.getDate("effective");
            int id = rs.getInt("id");
            System.out.println("id="+id+", effective="	+
effective.getTime());
        }
        connection.close();
    }
}

Schema Stuff:

CREATE TABLE date_test
(
  effective date,
  id int2
)

INSERT INTO date_test VALUES ('2005-07-26', 1);
INSERT INTO date_test VALUES ('2005-07-26', 2);
INSERT INTO date_test VALUES ('2005-07-26', 3);


The output results:

/usr/java14/bin/java -cp "/usr/insight/postgresql.jar:." DateTest

id=1, effective=1122350400000    <---  correct
id=2, effective=1122354000000    <---   +1 hour
id=3, effective=1122354000000    <---   all same from here out



-----Original Message-----
From: Oliver Jowett [mailto:oliver(at)opencloud(dot)com] 
Sent: Wednesday, July 27, 2005 6:59 PM
To: Byron Nikolaidis
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] Date problem on Aix jdk1.4.1

Byron Nikolaidis wrote:

> When I query any table with a regular old Date in it,  the first row
> that comes back is correct (some Date value with 00:00:00 as the time)
,
> however all subsequent rows are advanced by 1 hour (they have a time
of
> 01:00:00) .    This happens on any table. 

It's quite weird that it's different on the first row, otherwise I'd say
it was a local JVM timezone issue.

Do you have some test code we can try? Without knowing what the
underlying column's type is or which ResultSet accessor you're using
it's just guesswork.

-O

Responses

pgsql-jdbc by date

Next:From: Oliver JowettDate: 2005-07-27 23:37:15
Subject: Re: Date problem on Aix jdk1.4.1
Previous:From: Oliver JowettDate: 2005-07-27 23:10:15
Subject: Re: jdbc xa patches

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group