public static final List<Map<String,Object>> dateToStringList(List<Map<String,Object>> list,String fomate,String [] str){
Iterator<Map<String,Object>> it;
if(list!=null){
it = list.iterator();
}else{
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat(fomate);
List<Map<String,Object>> newList = new ArrayList<Map<String,Object>>();
while(it.hasNext()){
Map<String,Object> map = it.next();
for(int i=0;i<str.length;i++){
if(!WebUtil.isEmptyOrNull(map, str[i])){
Date date = (Date)map.get(str[i]);
String date1 = sdf.format(date);
map.put(str[i]+"_str",date1);
}
}
newList.add(map);
}
return newList;
调用上面的 函数
list=DateToStringUtil.dateToStringList(list, "yyyy年MM月dd日", new String[]{"转换格式参数1","转换格式参数2"});