pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Rohwer <rohwer@uiuc.edu>
To: pgsql-interfaces@postgresql.org
Subject: jdbc timestamp-parsing
Date: Sun, 03 Jan 1999 19:17:42 -0600
Message-ID: <369016B6.E9B16861@uiuc.edu> (raw)

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



Message-ID: <369016B6.E9B16861@uiuc.edu>
Permalink:  ../369016B6.E9B16861@uiuc.edu/
Also on:    postgresql.org/message-id/369016B6.E9B16861@uiuc.edu

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: rohwer@uiuc.edu
  Subject: Re: jdbc timestamp-parsing
  In-Reply-To: <369016B6.E9B16861@uiuc.edu>

* 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