package com.mosty.common.base.util;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.TemporalAdjusters;

public class LocalDateTimeUtils {
    /**
     * 获取当天最早时间
     * @return
     */
    public static LocalDateTime todayStart(){
        LocalDateTime today_start = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
        return today_start;
    }

    /**
     * 获取当天最晚时间
     * @return
     */
    public static LocalDateTime todayEnd(){
        LocalDateTime today_end = LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
        return today_end;
    }

    /**
     * 往前几天
     * @return
     */
    public static LocalDateTime daysStart(Integer day){
        LocalDateTime now = LocalDateTime.now().minusDays(day);
        return now;
    }

    /**
     * 往后几天
     * @return
     */
    public static LocalDateTime daysEnd(Integer day){
        LocalDateTime now = LocalDateTime.now().plusDays(day);
        return now;
    }
}
