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
This works for me ;)
public static Date getTwitterDate(String date) throws ParseException { final String TWITTER = "EEE, dd MMM yyyy HH:mm:ss Z"; SimpleDateFormat sf = new SimpleDateFormat(TWITTER, Locale.ENGLISH); sf.setLenient(true); return sf.parse(date); }