Java8中新引入的类LocalDateTime
LocalDateTime currentTime = LocalDateTime.now();
System.out.println("当前时间:" + currentTime);
System.out.println("week is " + currentTime.getDayOfWeek());
System.out.println("week is " + currentTime.getDayOfWeek().getValue());
输出:
当前时间:2019-12-03T16:17:27.712
week is TUESDAY
week is 2