日售出销量统计 前一天的

This commit is contained in:
2024-06-28 10:46:26 +08:00
parent a23ab97ebf
commit bb6226efab
7 changed files with 133 additions and 20 deletions

View File

@@ -35,6 +35,7 @@ public class DateUtil {
public static final DateTimeFormatter DFY_MD = DateTimeFormatter.ofPattern("yyyy-MM-dd");
private final static SimpleDateFormat sdfTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private final static SimpleDateFormat ymdTime = new SimpleDateFormat("yyyy-MM-dd");
/**
* LocalDateTime 转时间戳
@@ -50,6 +51,10 @@ public class DateUtil {
return sdfTime.format(date);
}
public static String getYMDTime(Date date) {
return ymdTime.format(date);
}
/**
* 将Date对象转换为时间戳毫秒
* @param date 要转换的Date对象
@@ -313,6 +318,22 @@ public class DateUtil {
return getDayEndTime(cal.getTime());
}
public static Date getBeginDayOfYesterday() {
Calendar cal = new GregorianCalendar();
cal.setTime(getDayBegin());
cal.add(Calendar.DAY_OF_MONTH, -1);
return cal.getTime();
}
// 获取明天的结束时间
public static Date getEndDayOfYesterday() {
Calendar cal = new GregorianCalendar();
cal.setTime(getDayEnd());
cal.add(Calendar.DAY_OF_MONTH, -1);
return cal.getTime();
}
// 获取明天的开始时间
public static Date getBeginDayOfTomorrow() {
Calendar cal = new GregorianCalendar();