查询数据起始时间判断
查询数据起始时间判断
当前端只显示日期的时候 我们查询一个范围内的日期 处理的工具类
import java.time.LocalDateTime;/*** @author changnayouguli* @description:* @date 2024/08/30 23:00*/
public class TimeRangeUtils {/*** 获取一天的零点* @param startTime* @return*/public static LocalDateTime getStartTime(LocalDateTime startTime) {if (ObjectUtilPlus.isNotEmpty(startTime)) {LocalDateTime localDateTime = startTime.withHour(0).withMinute(0).withSecond(0).withNano(0);return localDateTime;}return null;}/*** 获取一天的最后时间* @param endTime* @return*/public static LocalDateTime getEndTime(LocalDateTime endTime) {if (ObjectUtilPlus.isNotEmpty(endTime)) {LocalDateTime localDateTime = endTime.withHour(23).withMinute(59).withSecond(59).withNano(999999999);return localDateTime;}return null;}}