I get this from JQuery:
"Fri Nov 28 2014 10:19:52 GMT+0100 (CET)"
How do I format this String into a Date object in Java?
Try following code:
String date="Fri Nov 28 2014 10:19:52 GMT+0100 (CET)";
Date dateTime= new SimpleDateFormat("E MMM dd yyyy HH:mm:ss 'GMT'Z (z)").parse(date);
The dig is to use SimpleDateFormat to parse a String into Date.
For more on SimpleDateFormat visit this link.
EEE MMM dd YYYY HH:mm:ss 'GMT'Z (z) but it gave me back Fri Jan 03 2014 10:19:52 GMT+0100 (CET). Your format string works properly if I use Locale.US at the end, because it breaks with my locale (Hungarian). Thanks.