Android : Date formatting is not formatting correctly

on Monday, July 7, 2014


I can't figure out why this is returning Wed Jul 02 18:21:27 CDT 2014 instead of 07/02/14 6:21 pm



public void setPubDate(String pubDate) {

SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.ENGLISH);
long x = dateFormat.parse(pubDate).getTime();
Date date = new Date(x);
SimpleDateFormat newFormat = new SimpleDateFormat("MM/dd/yy H:mm aa");
newFormat.format(dateFormat.parse(pubDate));
this.pubDate = date;

}

0 comments:

Post a Comment