Archived Forum Post

Index of archived forum posts

Question:

JAVA/Android: How to convert the EMail Date to a java.util.Date??

May 26 '15 at 10:57

i wrote this:

String RFC822_DATE_FORMAT = "EEE, dd MMM yyyy HH:mm:ss Z";
DateFormat formatter = new SimpleDateFormat(RFC822_DATE_FORMAT);
CkString ckString    = new CkString();
...
actCkMail.get_EmailDateStr(ckString);
...formatter.parse(ckString.getString());

but i got:

java.text.ParseException: Unparseable date: "Thu, 16 Apr 2015 14:45:08 GMT"

What i have to do instead?


Answer

Okay ... for all they need this:

....new SimpleDateFormat(RFC822_DATE_FORMAT, Locale.ENGLISH);

the Locale is the Key :-)