关于java:LocalDateTime-获取最早最晚时间

7次阅读

共计 543 个字符,预计需要花费 2 分钟才能阅读完成。

    switch (timeUnitEnum){
      case WEEK:
        condition.setTimeBegin(condition.getTime().with(DayOfWeek.MONDAY).with(LocalTime.MIN));
        condition.setTimeBegin(condition.getTime().with(DayOfWeek.SUNDAY).with(LocalTime.MAX));
        break;
      case MONTH:
        condition.setTimeBegin(condition.getTime().with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN));
        condition.setTimeBegin(condition.getTime().with(TemporalAdjusters.lastDayOfMonth()).with(LocalTime.MAX));
        break;
      default:break;
    }

LocalDateTime 获取以后(年 / 月)第一天及最初一天 及 获取当天起始工夫

LocalDateTime 获取每周,每月,每年的第一天和最初一天,获取一周七天的日期,获取每月的所有日期

正文完
 0