List of utility methods to do LocalDate Calculate
boolean | isWeekend(LocalDate date) is Weekend return date.getDayOfWeek() == DayOfWeek.SATURDAY || date.getDayOfWeek() == DayOfWeek.SUNDAY;
|
boolean | isWorkDay(@Nonnull final LocalDate aDate) is Work Day return !isWeekend(aDate);
|
int | lastMonth(LocalDate date) last Month return date.minusMonths(1).getMonthValue();
|
long | localDate2ms(final LocalDate ld) LocalDate to ms. return ld.atStartOfDay().toEpochSecond(ZoneOffset.ofHours(9)) * 1000L;
|
LocalDate | LocalDateFromMilli(long value) Local Date From Milli final Instant instant = Instant.ofEpochMilli(value); final LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); return localDateTime.toLocalDate(); |
Date | localDateToSystemAdjustedStartOfDayDate(LocalDate d) Adjusts a LocalDate to Midnight of the say day (start of day). LocalDateTime ldt = d.atStartOfDay();
return getSystemDefaultDate(ldt);
|
LocalDate | max(ChronoLocalDate date1, ChronoLocalDate date2) max return LocalDate.from(date1.isBefore(date2) ? date2 : date1);
|
Instant | medTime(LocalDate date, String text) med Time return LocalDateTime.of(date, LocalTime.parse(text)).atZone(ZoneId.systemDefault()).toInstant();
|
LocalDateTime | minusDaysAdjustedToStartOfDay(LocalDate ld, int days) Takes the LocalDate, subtracts the day indicated from it, and adjusts it to Midnight (start of day). return ld.minusDays(days).atStartOfDay();
|
Date | newToOld(LocalDate d) new To Old return newToOld(d.atStartOfDay());
|