//只显示到天
LocalDate date = LocalDate.now();
//今天的日期:2022-08-24
System.out.println("今天的日期:" + date);
2、Java 8 中获取年、月、日信息
LocalDate date = LocalDate.now();
int year = date.getYear();
int month = date.getMonthValue();
int day = date.getDayOfMonth();
//year:2022
//month:8
//day:24
System.out.println("year:" + year);
System.out.println("month:" + month);
System.out.println("day:" + day);
3、Java 8 中处理特定日期
LocalDate date = LocalDate.of(2022,8,24);
//自定义日期:2022-08-24
System.out.println("自定义日期:"+date);