Reputation: 1044
I need to transform a date from this format : Tue Dec 10 09:00:00 EET 2013 into 3 12 2013 09:00
I've tried something like:
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm");
Date newdata = dateFormat.parse(pubDate);
SimpleDateFormat desiredDateFormat = new SimpleDateFormat("dd-MM-yyyy, hh:mm");
this.pubDate = desiredDateFormat.parse(desiredDateFormat.format(newdata));
but the date is not changing. How I can accomplish this? Thanks!
Upvotes: 4
Views: 120
Reputation: 5077
This simple line will solve your problem
android.text.format.DateFormat dateFormat= new android.text.format.DateFormat();
dateFormat.format("dd-MM-yyyy hh:mm", new java.util.Date());
Upvotes: 1