/**
* 将Date类型装换为String类型的
时间格式
* @param id // 转换格式的ID
* @param date // 时间参数
* @return
*/
public static String ToStringTime(int id, Date date) {
String resultTime = null;
Long time = System.currentTimeMillis();
SimpleDateFormat format = null;
switch (id) {
case 1:
format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
break;
case 2:
format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
break;
case 3:
format = new SimpleDateFormat("yyyy年MM月dd日HH:mm:ss");
break;
case 4:
format = new SimpleDateFormat("HH:mm");
break;
case 5:
format = new SimpleDateFormat("MM月dd日HH:mm");
break;
case 6:
format = new SimpleDateFormat("yyyy-MM-dd");
break;
}
resultTime = format.format(date);
return resultTime;
}