Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Converting String to Date without knowing specific format?

807606Feb 14 2007 — edited Feb 14 2007
I have a string that contains a date, in formats like MM/DD/YYYY, MM-DD-YYYY, YYYY-MM-DD, etc..., and need to convert it into a Date object. SimpleDateFormat::parse won't do, since it's not smart and can only work with a single, pre-specified format. I can easily perform this operation in Javascript, so I'm miffed as to why I'm having such a hard time doing the same in Java; Google and forum searches so far have turned up nothing.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 14 2007
Added on Feb 14 2007
6 comments
1,549 views