我想把Twitter响应中的日期字符串转换为日期对象,但我总是得到一个ParseException异常,我看不出错误在哪里!?!
输入字符串: Thu Dec 23 18:26:07 +0000 2010
SimpleDateFormat
格式:
EEE MMM dd HH:mm:ss ZZZZZ yyyy
方法:
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;
}
我也尝试了这个:http://friendpaste.com/2IaKdlT3Zat4ANwdAhxAmZ,但是结果相同。
我在Mac OS X上使用Java 1.6。
谢谢,
Andi