Skip to content

Instantly share code, notes, and snippets.

@mortenjust
Created September 28, 2015 02:53
Show Gist options
  • Save mortenjust/81d2ade21e4fca40e629 to your computer and use it in GitHub Desktop.
Save mortenjust/81d2ade21e4fca40e629 to your computer and use it in GitHub Desktop.
Parse date from RSS feed
public Date getNewestDateTime(){
String stringDate = getLatestEpisode().getPubDate();
Log.d(TAG, "stringdate is "+stringDate);
SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z", Locale.ENGLISH);
try{
Date date = format.parse(stringDate);
Log.d(TAG, "parsed date: "+date);
return date;
} catch(ParseException e) {
Log.d(TAG, "parse exception for date");
e.printStackTrace();
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment