SimpleDateFormat解析器

时间:2013-12-16 09:07:59

标签: android simpledateformat

我需要从这种格式转换日期:Tue Dec 10 09:00:00 EET 2013 into 3 12 2013 09:00

我尝试过类似的事情:

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));

但日期不变。我怎么能做到这一点? 谢谢!

1 个答案:

答案 0 :(得分:1)

这个简单的行将解决您的问题

android.text.format.DateFormat dateFormat= new android.text.format.DateFormat();
dateFormat.format("dd-MM-yyyy hh:mm", new java.util.Date());