lundi 7 juillet 2014

Date formatting is not formatting correctly


Vote count:

0




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;

}


asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire