嗨,我有一个像这样的字符串:
String selectedDate = "Fri Jan 17 00:00:00 CAT 2014";
我需要将其格式化为:
DD.MM.YYYY = 17.01.2014 00:00:00
谁能帮忙,请参见下面的代码:
String date = getDate(selectedDate);
private String getDate(String inpuDate) {
Date date = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss ").parse(inputDate);
return new SimpleDateFormat("dd.mm.yyyy hh:mm:ss").format(date);
}
请尝试以下方法:
String date = getDate(selectedDate);
private String getDate(String inpuDate) {
Date date = new SimpleDateFormat("EEE MMM d hh:mm:ss z yyyy").parse(inputDate);
return new SimpleDateFormat("dd.MM.yyyy hh:mm:ss").format(date);
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句