[Solved] How to solve the error convert String date from xml file to an int format?


The problem is in your lines

DateFormat dfq = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.FRENCH);
Date date1 = dfq.parse(dateq);

You got a ParseException because in " Tue Feb 08 12:30:27 +0000 2011 "
you have leading and trailing space, and the parts Tue and Feb are English but not French.

Change these lines to

DateFormat dfq = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH);
Date date1 = dfq.parse(dateq.trim());

and it will work.

6

solved How to solve the error convert String date from xml file to an int format?