This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Java in General and the fly likes Date Format Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Date Format Problem" Watch "Date Format Problem" New topic

Date Format Problem

Pol Appan
Ranch Hand

Joined: Aug 26, 2004
Posts: 144
I have date which is in the format 2006-04-21 23:31:48.0

str_dt = 2006-04-21 23:31:48.0

When I used format_dt = inputFormat.parse(str_dt);

I am getting excpetion java.text.ParseException: Unparseable date: "2006-04-21 23:31:48.0"

How can I resolve this? I need to format my date and insert into oracle database with date and time.

Thanks in advance

Never take anything for granted because you never know when you will lose it
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

You should set the proper format first:

[My Blog]
All roads lead to JavaRanch
I agree. Here's the link:
subject: Date Format Problem
It's not a secret anymore!