pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Byron Nikolaidis <ByronN@Routescape.com>
To: Oliver Jowett <oliver@opencloud.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Date problem on Aix jdk1.4.1
Date: Wed, 27 Jul 2005 19:20:24 -0400
Message-ID: <6E0907A94904D94B99D7F387E08C4F570732F0@FALCON.INSIGHT> (raw)


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@opencloud.com] 
Sent: Wednesday, July 27, 2005 6:59 PM
To: Byron Nikolaidis
Cc: pgsql-jdbc@postgresql.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



view thread (8+ messages)  latest in thread

Message-ID: <6E0907A94904D94B99D7F387E08C4F570732F0@FALCON.INSIGHT>
Permalink:  ../6E0907A94904D94B99D7F387E08C4F570732F0@FALCON.INSIGHT/
Also on:    postgresql.org/message-id/6E0907A94904D94B99D7F387E08C4F570732F0@FALCON.INSIGHT

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: ByronN@Routescape.com, oliver@opencloud.com
  Subject: Re: Date problem on Aix jdk1.4.1
  In-Reply-To: <6E0907A94904D94B99D7F387E08C4F570732F0@FALCON.INSIGHT>
  References: <6E0907A94904D94B99D7F387E08C4F570732F0@FALCON.INSIGHT>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox