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

Re: JDBC Timestamp problem

From: Jeff Hoffmann <jeff(at)propertykey(dot)com>
To: Antonio Fiol <fiol(at)w3ping(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JDBC Timestamp problem
Date: 2001-02-22 17:04:58
Message-ID: 3A9546BA.366A51D@propertykey.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Antonio Fiol wrote:
> 
> Hello,
> 
> I have an application that worked well woth Postgresql 6.5.
> 
> Now I am on 7.0, and I get this exception when I execute an
> rs.getTimestamp("reftime"):
> 
> Bad Timestamp Format at 0 in 1970-01-01 01:26:56.99+01
>         at
> org.postgresql.jdbc1.ResultSet.getTimestamp(ResultSet.java:445)
>         at
> org.postgresql.jdbc1.ResultSet.getTimestamp(ResultSet.java:587)
> 
> Any idea of what it might be ?

it's the timezone part ("+01") that's causing the problems.  it's not
supposed to be there, hence the error in parsing the timestamp.  i've
had the problem before & here's the way i solved it:

 Timestamp expires =
Timestamp.valueOf(rs.getString("field_name").substring(0,19));

there might be a way to alter the output format of the date, but i don't
know how.  maybe peter can help us out there or have some sort of
official response.

-- 

Jeff Hoffmann
PropertyKey.com

In response to

pgsql-jdbc by date

Next:From: Peter T MountDate: 2001-02-22 17:06:38
Subject: Re: JDBC Timestamp problem
Previous:From: Antonio FiolDate: 2001-02-22 16:33:49
Subject: JDBC Timestamp problem

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