I have a string named DateCompareOld, it has the value "Fri Aug 12 16:08:41 EDT 2011". I want to convert this to a date object.
SimpleDateFormat dateType = new SimpleDateFormat("E M dd H:m:s z yyyy");
Date convertDate = dateType.parse(DateCompareOld);
But everytime I try this, I get a parse exception. I have tried other SimpleDateFormat formatting criteria, but it always fails.
Suggestions?
Try this format:
Quick test:
Output is in CDT, since that’s where I am, but the value is right.