jdbc timestamp-parsing - Mailing list pgsql-interfaces

From Thomas Rohwer
Subject jdbc timestamp-parsing
Date
Msg-id 369016B6.E9B16861@uiuc.edu
Whole thread Raw
List pgsql-interfaces
There is a little typo in the code for getTimestamp
in the file jdbc1/ResultSet.java and jdbc2/ResultSet.java

  public Timestamp getTimestamp(int columnIndex) throws SQLException
  {
    String s = getString(columnIndex);
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd
HH:mm:sszzz");

    if (s != null)
      {
    int TZ = new Float(s.substring(19)).intValue();
    TZ = TZ * 60 * 60 * 1000;
    TimeZone zone = TimeZone.getDefault();
    zone.setRawOffset(TZ);
    String nm = zone.getID();
-->    s = s.substring(0,18) + nm; // should probably be s.substring(0,19)+
nm

which leads to an incorrect interpretation of timestamps:

timestamp:1999-01-03 18:35:47+01
date:1999-01-03 18:35:04.0

.


Thomas Rohwer

pgsql-interfaces by date:

Previous
From: Michael Philipp
Date:
Subject: subscribe
Next
From: Tom Lane
Date:
Subject: Re: [INTERFACES] Problems building libpgtcl