I have a date string in the following format:
Thu Oct 20 14:39:19 PST 2011
I would like to parse it using a DateFormat to get a Date object. I try it like this:
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT); Date date = df.parse(dateString);
This gives a ParseException ("unique date").
I also tried this:
SimpleDateFormat df = new SimpleDateFormat("EEE-MMM-dd HH:mm:ss z yyyy");
with the same results.
Is this the correct SimpleDateFormat
line? Is there a better way to analyze this date?
source share