//获取当前时间
LocalDate localDate=LocalDate.now();
//规定一个日期类型数据
LocalDate localDate1 = LocalDate.of(2022, 9, 18);
//获取当前日期和时间
LocalDateTime localDateTime = LocalDateTime.now();
//获取当前月份是今年第几个月
int month1 = localDate.get(ChronoField.MONTH_OF_YEAR);
//获取当前时间日期是周几
DayOfWeek dayOfWeek = localDateTime.getDayOfWeek();
//获取当前时间日期是一周内第几天
int dayOfWeek1 = localDate.get(ChronoField.DAY_OF_WEEK);
JDK1.8 Date时间常用方法
最新推荐文章于 2023-12-05 13:41:11 发布