public class DateFormateUtil {
public static SimpleDateFormat simpleDateFormat = null;
public static String getDateFormat(Integer integer) {
switch (integer) {
case 1:
simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH点mm分ss秒");
break;
case 2:
simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
break;
case 3:
simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
break;
case 4:
simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss");
break;
case 5:
simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
break;
default:
simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
break;
}
return simpleDateFormat.format(new Date());
}
public static void main(String[] args) {
System.out.println(DateFormateUtil.getDateFormat(5));
}
}