@Testpublic void test() {
// now() 获取当前的时间,日期LocalDate ld = LocalDate.now();LocalTime lt = LocalTime.now();LocalDateTime ldt = LocalDateTime.now();System.out.println(ld);System.out.println(lt);System.out.println(ldt);// of():指定年月日 时分秒 没有偏移量LocalDateTime ldt1 = LocalDateTime.of(2021,9,22,17,00,00);System.out.println(ldt1);// getXxx() System.out.println(ldt.getDayOfYear());System.out.println(ldt.getDayOfWeek());System.out.println(ldt.getDayOfMonth());System.out.println(ldt.getMonth());System.out.println("mouthValue:"+ldt.getMonthValue());System.out.println(ldt.getMinute());// withXXX() :可以体现不可变性LocalDate ld1 = ld.withDayOfMonth(26);System.out.println(ld);System.out.println(ld1);}