Twitter date unparseable?
Posted
by
Andreas
on Stack Overflow
See other posts from Stack Overflow
or by Andreas
Published on 2010-12-23T19:09:43Z
Indexed on
2010/12/23
22:54 UTC
Read the original article
Hit count: 295
Hi,
I want to convert the date string in a Twitter response to a Date object, but I always get a ParseException and I cannot see the error!?!
Input string: Thu Dec 23 18:26:07 +0000 2010
SimpleDateFormat
Pattern:
EEE MMM dd HH:mm:ss ZZZZZ yyyy
Method:
public static Date getTwitterDate(String date) {
SimpleDateFormat sf = new SimpleDateFormat(TWITTER);
sf.setLenient(true);
Date twitterDate = null;
try {
twitterDate = sf.parse(date);
} catch (Exception e) {}
return twitterDate;
}
I also tried this: http://friendpaste.com/2IaKdlT3Zat4ANwdAhxAmZ but that gives the same result.
I use Java 1.6 on Mac OS X.
Cheers,
Andi
© Stack Overflow or respective owner