I have a string that contains the representation of a date. It looks like:
Thu Nov 30 19:00:00 EST 2006
I’m trying to create a Date object using SimpleDateFormat and have 2 problems.
1.) I can’t figure out the pattern to hard-code the solution into the SimpleDateFormat constructor
2.) I can’t find a way I could parse the string using API to determine the pattern so I could reuse this for different patterns of date output
If anyone knows a solution using API or a custom solution I would greatly appreciate it.
The format to pass to SimpleDateFormat could be looked up at http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html
As for your second question, I don’t know of any Java library to figure out a date format and parse it without knowing in advance what the format is.