@Test
public void local(){
LocalDate localDate
= LocalDate
.now();
System
.out
.println(localDate
);
LocalDateTime localDateTime
= LocalDateTime
.now();
System
.out
.println(localDateTime
);
System
.out
.println(localDateTime
.getDayOfMonth());
System
.out
.println(localDateTime
.getDayOfWeek());
System
.out
.println(localDateTime
.getDayOfYear());
System
.out
.println(localDateTime
.getHour());
LocalTime localTime
= LocalTime
.now();
System
.out
.println(localTime
);
}
}
附加
@Test
public void instant(){
Instant instant
= Instant
.now();
System
.out
.println(instant
);
}
转载请注明原文地址:https://tech.qufami.com/read-15625.html