Convert dateString from browser to java.util.Date?

I am having trouble parsing / converting a dateString from browser format to Date in Java. Below are some of the values ​​that I got from the browser.

dateStr = "01-01-2010 05:06:22";
dateStr = "Mon Oct 11 07:00:00 EDT 2010";
dateStr = "Fri May 25 2012 08:00:00 GMT-0400 (Eastern Daylight Time)";

Each dateStr is in a different format, and in the background I used SimpleDateFormat with a specific format to convert dateStr. Since the dateStr format does not match, any idea on how this can be handled in the backend?

Access to external code / people is limited.

PS: I did google about this and read related topics here in StackOverflow.

Any help is appreciated. Thank.

+3
source share
1 answer

, . , . SimpleDateFormat.

, SimpleDateFormat null ( ), Date. : , ( 02-01-2012 2 1 ?) , ...

+3

All Articles