```
1 public static void main(String[] args) throws ParseException {
2
3 SimpleDateFormat sdf =new SimpleDateFormat("yyyy/MM/dd HH:mm:ss" );
4 String beginStr1 = "2021/11/24 10:50:13"; // 开始时间1
5 String beginStr2 = "2022/04/11 10:50:15"; // 开始时间2,注意时间中的时分秒对getAlmostDayRangeWithoutDay方法的影响
6
7 Date begin=sdf.parse(beginStr1);
8 Date end=sdf.parse(beginStr2);
9
10 System.out.println(getAlmostDayRangeWithoutDay(begin, end));
11
12 System.out.println(getDayRange(begin,end));
13 }
14
15 /**
16 * 帮助方法:{0,日期1}与{1,日期2}相差的天数(不足一天舍去)
17 *
18 * @param beginDate 开始日期
19 * @param endDate 结束日期