Home arrow static arrow Java Programming [Archive] - Unparseable date Error
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Unparseable date Error
This topic has 2 replies on 1 page.

Posts:113
Registered: 5/26/04
Unparseable date Error  
Aug 4, 2004 8:02 AM



 
I'm getting java.text.ParseException: Unparseable date: "2004-07-05 11:45:49.0"

"2004-07-05 11:45:49.0" is what I'm getting from Oracle. I'm getting the field as a String since resultSet.getDate() returns null despite the field in Oracle is implemented as a DATE. So when I get the String I want it to convert it to java.util.Date but throws the exception above.

My current code is

DateFormat df = DateFormat.getDateInstance(); //loop...	String dateString = ((Object)rs.getObject(i)).toString();	java.util.Date date = df.parse(dateString);


Thanks for suggestions
 

Posts:21
Registered: 2/10/99
Re: Unparseable date Error  
Aug 4, 2004 8:15 AM (reply 1 of 2)



 

Have you looked at SimpleDateFormat? I think this is what you're looking for.

--mb
 

Posts:37,103
Registered: 3/30/99
Re: Unparseable date Error  
Aug 4, 2004 8:17 AM (reply 2 of 2)



 
Did you read the docs for DateFormat.getDateInstance? Does it say that the instance returned will parse a date of that format?

If you know the specific format you want to parse you should construct a SimpleDateFormat object using that format.
 
This topic has 2 replies on 1 page.