/***
* @param localDateTime
* @return: boolean
* @since 1.0.0
* @Description: 判断时间是否在本月之内
*/
public boolean isInThisMonth(LocalDateTime localDateTime) {
LocalDate localDate = localDateTime.toLocalDate();
LocalDate now = LocalDate.now();
return localDate.isAfter(now.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth())) &&
localDate.isBefore(now.plusMonths(1).with(TemporalAdjusters.firstDayOfMonth()));
}
判断时间是否在本月之内
最新推荐文章于 2023-12-05 16:37:42 发布