Lists: | PostgreSQL : PostgreSQL |
---|
From: | Thomas Rohwer <rohwer(at)uiuc(dot)edu> |
---|---|
To: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | jdbc timestamp-parsing |
Date: | 1999-01-04 01:17:42 |
Message-ID: | 369016B6.E9B16861@uiuc.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | PostgreSQL : PostgreSQL |
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