[jdom-interest] ResultSetBuilder and Date Problems
Abhishek Srivastava
abhisheks at india.hp.com
Sat May 26 04:06:52 PDT 2001
Hello All,
I successfully converted a JDBC ResultSet into a JDOM structure. The XML
produced looks as follows
<result>
<entry>
<CREATED_AT>Thu May 24 00:00:00 GMT+05:30 2001</CREATED_AT>
</entry>
</result>
Now I want to read this XML and insert into another DB
But when I try to convert the String (CREATED_AT) produced by the ResultSet
Builder into a date I get an exception.
How Can I convert the string produced by the ResultSet Builder into a
java.sql.date ?
I tried the following
String date =
root.getRootElement().getChild("entry").getChild("CREATED_AT").getText();
java.sql.Date sqlDate = new
java.sql.Date(DateFormat.getDateTimeInstance(DateFormat.FULL).parse(date).ge
tTime());
The error I got was
java.text.ParseException: Unparseable date: "Thu May 24 00:00:00 GMT+05:30
2001"
at java.text.DateFormat.parse(DateFormat.java:324)
I feel that the ResultSetBuilder should produce a string that the DateFormat
class can parse back into a java.sql.Date.
What do youjava.text.ParseException: Unparseable date: "Thu May 24 00:00:00
GMT+05:30 2001"
at java.text.DateFormat.parse(DateFormat.java:324)
I feel that the ResultSetBuilder should produce the string output of a date
that the date format class can parse back into a date.
regards,
Abhishek.
The most exciting phrase in science, the one which heralds
new discoveries, is not Eureka!! but 'That's Funny'
-- Issac Asimov.
More information about the jdom-interest
mailing list