peter
2026-01-11 9c638d29f43035bb224996f3183a58d761cd526e
src/main/java/com/nq/utils/DateTimeUtil.java
@@ -13,6 +13,9 @@
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.Calendar;
import java.util.Date;
@@ -202,6 +205,24 @@
        return false;
    }
    public static boolean isCanSellOneday(Date buyDate, int day) {
        try{
            LocalDateTime buyTime = buyDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
            LocalDateTime futureDate = buyTime.plusDays(day);
            LocalDateTime zeroTime = futureDate.truncatedTo(ChronoUnit.DAYS);
            Long buyDateTimes = Long.valueOf(zeroTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli() / 1000L);
            Long nowDateTimes = Long.valueOf((new Date()).getTime() / 1000L);
            if (nowDateTimes.longValue() > buyDateTimes.longValue()) {
                return false;
            }
            return true;
        }catch (Exception e){
            return true;
        }
    }
    /*日期年月日是否相同*/
    public static boolean sameDate(Date d1, Date d2) {
        SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd");