获取星期几不用再写switch了
public static void main(String[] args) {
System.out.println(new SimpleDateFormat("EEEE").format(new Date()));
System.out.println(new SimpleDateFormat("yyyy-MM-dd ").format(new Date()));
System.out.println(new SimpleDateFormat(" HH:mm:ss").format(new Date()));
System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
}
运行结果
星期四
2020-11-05
14:40:53
2020-11-05 14:40:53