code: private static LocalDateTime getTime(String format, String date) {
          DateTimeFormatter formatter;
          //优先从缓存取，取不到创建一个，不用加锁
          if ((formatter = FORMATTER_CACHE.get(format)) == null) {
              formatter = DateTimeFormatter.ofPattern(format);
              FORMATTER_CACHE.put(format, formatter);
          }
  
          TemporalAccessor accessor = formatter.parse(date);
          LocalDateTime time;
  
          //判断日期类型，新版日期类将时间分为年月日（LocalDate）、时分秒（LocalTime）、年月日时分秒（LocalDateTime）三种类型
          if (accessor.isSupported(ChronoField.DAY_OF_YEAR)
              && accessor.isSupported(ChronoField.SECOND_OF_DAY)) {
              time = LocalDateTime.from(accessor);
          } else if (accessor.isSupported(ChronoField.SECOND_OF_DAY)) {
              LocalTime localTime = LocalTime.from(accessor);
              time = localTime.atDate(LocalDate.now());
          } else if (accessor.isSupported(ChronoField.DAY_OF_YEAR)) {
              LocalDate localDate = LocalDate.from(accessor);
              time = localDate.atTime(LocalTime.now());
          } else {
              throw new DateUtilException("日期类解析异常，时间为：" + date + "；格式为：" + format);
          }
          return time;
      }
docs: 从指定日期字符串获取LocalDateTime对象
  @param format 日期字符串格式
  @param date 日期字符串
  @return LocalDateTime对象